4 ms·
Ooooh man, I would love to do that. I enjoy writing markdown, and I enjoy using pandoc. However, whenever I have to print something, there is pretty much just
by donquichotte 9y ago
Ooooh man, I would love to do that. I enjoy writing markdown, and I enjoy using pandoc.
However, whenever I have to print something, there is pretty much just one possibility in Markdown: export as pdf. And export as pdf uses Latex. Latex is cool. But if you want to customize your document, you will sooner or later need to include latex headers into the "build" process of your file, and soon you have a clusterfuck of tooling and a make file for a document that was supposed to be a simple report. And then I'd rather write it in Latex.
Does anybody have a solution for this? Some kind of print-friendly Markdown-to-PDF workflow? All the non-Latex alternatives looked horrible. In fact, I sometimes export markdown documents to Word just to print them.
- xienze 9y agoMD->HTML->PDF. Just use a browser to render your document. You can make the process a bit more automated by using something like Chrome Headless. I'm sure there's a project out there that does this all in one step from the commandline.
- donquichotte 9y agoThis approach is what I have sometimes been using. It works OK and I can style my documents with CSS. But there are little things that bug me, like headlines on the last line of page N and the paragraph starting on page N+1 and header/footer lines generated by the browser.
- laxis 9y agofor what it's worth you can define pagebreaks with css [0]. it's not the most user-friendly way, but works. the @page rule also comes in quite handy [0]: https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-inside https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-...
- nathan_long 9y agoMy setup: 1) I have cmark installed 2) https://github.com/nathanl/.dotfiles/blob/master/bin/md_preview https://github.com/nathanl/.dotfiles/blob/master/bin/md_prev... is a script to render STDIN to HTML and slap the output into the middle of a template that has some basic CSS (https://github.com/nathanl/.dotfiles/blob/master/bin/md_preview_template.html https://github.com/nathanl/.dotfiles/blob/master/bin/md_prev...) 3) I write markdown in Vim and use keybindings to say "now output HTML from this buffer" - https://github.com/nathanl/.dotfiles/blob/ede8c98a7897ee07b724b4225c2ac3a765341c25/vim/vimrc#L299-L302 https://github.com/nathanl/.dotfiles/blob/ede8c98a7897ee07b7... I like this mainly because it lets me use Vim, which for me is the most efficient tool for wrangling text. I also like avoiding WISYWIG programs that I previously fought with - eg, trying to get Word to understand which bullet points I wanted nested under which other ones was frustrating, but with markdown (and embedded HTML when necessary) I can be 100% explicit. Sometimes I copy-paste the resulting HTML into Google Docs or elsewhere and do further tweaks, but most of the time it's enough for me as-is.
- seanmcdirmid 9y agoHave you checked out Madoko? https://www.madoko.net https://www.madoko.net > Madoko is a fast markdown processor for writing professional articles, books, manuals, webpages and presentations, with a focus on simplicity and plain text readability. > With Madoko you can write complex documents completely in markdown and get beautiful PDF and HTML output.
- kstenerud 9y agoIt's unfortunate that their front page has broken layout. "Madoko = LATEX x Markd"
- danielbarla 9y agoI guess it depends on what you mean by "looked horrible". I've found some of the MD to PDF plug-ins for Atom were acceptable for short documents. For bigger ones, I'd probably want more control over formatting, and would go via pandoc.
- cup-of-tea 9y agoWhat is your gold standard here? I can only assume you're comparing to hand-written LaTeX. But if that is a feasible option for you then you might as well stick with it. Using something simple like markdown is really a compromise for non-TeXnical-typists.
- shadowfiend 9y agoI use asciidoc (via asciidoctor), which is based on Docbook and therefore supports a lot more complex document features. Its PDF export is quite excellent IMO, and doesn't require LaTeX (though it can go through LaTeX).
- deleted 9y ago[deleted]
- JasonFruit 9y agoI'm definitely late to the party, but I've used Markdown, CSS, and Weasyprint to make some attractive PDF files (including my resumé, so I put my money where my mouth is). It lets me style things as I like without much extra work, and since Markdown produces simple, predictable HTML, I can keep a library of styles that I can apply to any document.