This sounds like the CSS @media print with extra steps
post
There's a lot of libraries that convert html to markdown (and in the process get rid of all the javascript spyware).
The android app markdownr can do this on the fly, and I had an idea to create a markdown web browser using that as a base, but no time to work on it.
I mean you can do HTML -> TeX -> PDF with Pandoc, or to any other format pretty much. I would say writing markdown and passing it to TeX or directly to PDF is the most practical.
Yes this is a thing and it's been around for quite some time. If you're trying to approximate TeX, you may also be interested in MathML.
I need to go lay down; I'm having flashbacks to the good old days of "XML everywhere for everything all the time".
I use this one, and it's pretty nice: https://weasyprint.org/. They implement their own rendering engine so its support of new features and edge cases isn't the best, but every problem I've run into with it has been solvable with a little work. I really like it for laying out printed forms!
Thanks all - It seems there are many ways to do this, or perhaps just write the document in markdown and print it that way. I mean I guess I could always install and lear TeX (again) too.
I write business letters in HTML. I have a custom letter.css and a base letter.html+.js that loads individual letters into a template. I have some custom tags for date, address and similar. The individual docs are super clean. I can export compiled html files with embedded css (no js needed) and images that render perfectly and are even smaller then the pdfs I export (print) and those are small too.
Two downsides. The biggest problem, I didn't find a way to do proper multi page docs. And especially Firefox has limited print css support.
Second: everything is crudely hacked together and in no way usable by others...
maybe chatgpt can rewrite the code better, so I can publish it?
all 9 comments