

GitHub - RelaxedJS/ReLaXed: Create PDF documents using web technologies
source link: https://github.com/RelaxedJS/ReLaXed
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
ReLaXed
ReLaXed is a software to create PDF documents interactively using HTML or Pug (a shorthand for HTML). It enables to define complex layouts with CSS and Javascript while writing the content in a friendly, minimal syntax close to Markdown or LaTeX.
Here it is in action in the Atom editor:
And here are a few output examples:
Book -
source /
PDF
Letter -
Source /
PDF
Resume -
Source /
PDF
Visit card -
Source /
PDF
Slides -
Source /
PDF
Report -
Source /
PDF
Paper -
Source /
PDF
Poster -
Source /
PDF
ReLaXed has support for Markdown, LaTeX-style mathematical equations (via MathJax), CSV conversion to HTML tables, plots generation (via Vegalite or ChartJS), diagram generation (via Mermaid). Many more features can be added simply by importing an existing Javascript of CSS framework.
Installing ReLaXed
At the moment, the best solution is to install ReLaXed in an empty directory as follows:
git clone https://github.com/RelaxedJS/ReLaXed.git .
npm install
sudo npm link --unsafe-perm=true
This provides your system with the relaxed
command.
Hopefully in the future install will be as simple as npm i -g relaxedjs
, but there are known issues with puppeteer. In case it doesn't work for you, have a look at the troubleshooting page. Any help towards a simpler install procedure is welcome.
Getting started
To start a project, create a new empty file my_document.pug
, and start a ReLaXed process from a terminal:
relaxed my_document.pug
ReLaXed will watch my_document.pug
and its directory. Everytime a file changes, my_document.pug
will be compiled as my_document.pdf
.
Now write and save the following in my_document.pug
:
h1 My document's title p A paragraph in my document
A new file my_document.pdf
will be created. Every time you modify and save the sources, the file is automatically updated (make sure to use a PDF viewer with auto-refresh to see you changes happen in real-time). That's all there is to know to start writing your first documents !
To go further:
- Learn more about the capabilities of the Pug language.
- Browse the examples
- Read about our recommended setup to use ReLaXed
- Learn some advanced features of ReLaxed
- Read these comparisons of ReLaXed and other document editing systems
Why yet another PDF document creator ?
Many of us prefer mark-up languages (Markdown, LaTeX, etc.) to interfaced document editors like Ms Office or Google Docs. This is because mark-up languages make it easier to quickly write documents with consistent style.
However, Markdown is limited to the title/sections/paragraphs structure, and LaTeX has obscure syntax and errors that also make it difficult to go off the beaten tracks.
On the other hand, web technologies have never looked so good.
- Beautiful CSS frameworks will make sure your documents look clean and modern.
- There are Javascript libraries for pretty much anything: plotting, highlight code, rendering equations...
- Millions of people (and growing) know how to use these.
- Shorthand languages like Pug and SCSS are finally making it fun to write HTML and CSS.
- (Headless) web browsers can easily turn web documents into PDF, on any platform.
ReLaXed is an attempt at finding the most comfortable way to leverage this for desktop PDF creation.
How ReLaXed works
ReLaXed consists of few lines of code binding together other software. It uses chokidar to watch the file system. when a file is changed, several javascript libraries are used to compile SCSS, Pug, Markdown, and diagram files (mermaid, flowchart, ChartJS) into an HTML page which is then printed to a PDF file by a headless instance of Chromium (via puppeteer).
Contribute !
ReLaXed is an open source framework originally written by Zulko and released on Github under the ISC licence. Everyone is welcome to contribute!
Recommend
-
11
Ben Simner, Shaked Flur, Christopher Pulte, Alasdair Armstrong, Jean Pichon-Pharabod, Luc Maranget, Peter Sewell Abstract Computing relies on architecture specifications to decouple hardware an...
-
7
Version 2.5 A more liberal style guide for RuboCop. It comes with a config fil...
-
6
Apple agrees to relax App Store rules for ‘reader’ apps like Netflix, SpotifyA small step in the right direction.Photo: AppleApple will relax App Store rules for “reader” apps that let users access previously purc...
-
2
Copy link Contributor lcnr commented
-
9
Copy link Contributor Author lcnr comment...
-
2
This atomic is not synchronizing anything outside of its own value, so we don't need the Acquire/Release guarantee that all memory operations prior to the store are visible after the subseq...
-
9
New issue gerrit: Google/Gmail account requirement should be relaxed #49383 Closed
-
7
Conducting user research with relaxed usersHow to relax participants and why this is important when researching chilled-out activities
-
8
No Man’s Sky 4.0 trailer shows off streamlined UI and new relaxed modeNo Man’s Sky 4.0 trailer shows off streamlined UI and new relaxed mode / The free update drops today alongside the Nintendo Switch launch
-
8
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK