I have some really stupid questions about markdown, I don’t really where to ask them, so I thought here is as good as any other place.
Is there any program that can convert markdown to “beautiful” PDF? for some definition of beautiful, and that can be tweaked to provide advanced formatting?
My main gripes with markdown are:
1) I can't make complex documentents (ie with cross references and included code)
2) The output is not well defined
3) I want beautiful PDF and some fancy formatting
I’m not sure if this is even possible in markdown - but it would be nice.
For complex documents I can imagine embedding markdown inside
XML (ie in a … tag and then converting the XML to PDF via either LaTeX or XSL-FO.
The problem with markdown seems to be twofold - firstly it can contain
embedded HTML, and secondly it seems to want control characters
to be in column one (or am I wrong) - this means markdown embedded inside xml cannot be indented correctly and looks ugly.
I would very much like to see a stand-alone program that can take
a style file and a markdown files as input and produce beautiful PDF as
output. The output format should be tweakable by changing the style file.
The route from Markdown to PDF seems a bit tortuous and needs to go via LaTeX or XSL-FO. Alternatives would be my old erlguten (which is not well maintained) or via (say) libharu (which as far as I know has not been interfaced to Erlang/Elixir)
A second route to PDF would be via postscript and ps2pdf - but postscript does not support opentype fonts and so on.
Is what I want impossibly difficult? - or should I give up on markdown and write directly in TeX (or LaTeX)
In this regard I am not concerned about the simplicity of the input I am concerned about the beauty of the output - I fully accept that complex output (like math equations) will require complex input - but for simple formatted text a simple input format should suffice.
Do you have an issue with going through html at all? There are various options out there to render html into pdf content (some better some worse) and markdown to html + some css can be quite powerful.
I’m currently using https://github.com/Kozea/WeasyPrint for html -> pdf conversion and it’s doing quite fine. It has support for some of the newer css stuff and does not start up a whole browser (/-emulator).
Have you tried pandoc? It has a lot of goodies, including being able to convert a bunch of document formats to other document formats.
The wiki for pandoc has a lot of resources. I’m not sure if their idea of templates fits your idea of a style file, but maybe it will give you some inspiration or help you find something better. The templates page might give you an idea of whether it’s going to work for you or not.
Honestly it sounds like you want ReSt or AsciiDoc instead of Markdown. ^.^
Markdown is designed to be super-simple, no-frills stuff. AsciiDoc has a syntax very similar to Markdown, but significantly more fleshed out with many features you are looking for, and of course ResT(ructuredText) has a slightly different syntax (pretty similar though) but can basically do it all short of LaTeX itself (which can always be better).
As for to PDF, I’d just have markdown export to HTML with an appropriate CSS, then use an HTML->PDF converter (there is one for elixir) to convert it to the PDF.
As stated, it’s very limited… ^.^;
I’d definitely recommend going through HTML instead as that is what Markdown is really designed for (unlike AsciiDoc/ReSt/LaTeX).
When I had a loose collection of markdowns here and latex there or even context somewhere else, I am slowly migrating to org-modes markup language for everyday documentation and writings.
Documents I push as README to github are still markdown though, since the org-renderer used by github is not that good But I do consider pre-rendering a README.org into README.md or README.html nowadays.
But if you want to stick with markdown for any reasons, you might want to try pandoc, it still uses LaTeX for anything to PDF…