This is an exploration of using HTML+CSS and browser "print to pdf" as a vehicle for creating formatted PDFs.
This has only been tested in Firefox.
View a rendered version here: sveltedoc.pages.dev
Read more about it on my website: dominicdoty.com
I've recently been using asciidoc to create formatted documents. While it is overall an excellent tool, I've found it lacking in a few ways, namely:
LATEX counters some of these shortcomings, but is difficult in other ways.
I decided to explore the possibility of using HTML+CSS to create a web page that was formatted like a document, and could be printed to a PDF with identical formatting. This is an attempt at this idea.
I chose to use Svelte since I'm familiar with it.
Hopefully the combination of mdsvex
(markdown->svelte transformer) and Svelte components would prove a potent combination of simplicity for typical editing use cases, and the full power of HTML+CSS layout when needed.
I'm not convinced this is any better than LATEX or asciidoc, but it was an interesting exercise.
There are several outstanding issues in this demo:
Reactivity is broken
content.md
file.Document content is held in a single content.md
file at the moment
*.md
files in the doc
directory and rendering them in order of filenames.The TitlePage and TableOfContents are both included in the App.svelte
file
doc
folder and have a top level app that auto renders them and all *.md
files there also.Pagination problems
Figure/Table Numbers/Captions and Table of Figures/Tables
Cross referencing to sections/figures/tables is not implemeneted
href=#My Section
) workPDF bookmarks