Reputation: 395
I have markdown documents that I create pdf's from with a script:
#!/usr/bin/env bash
set -euxo pipefail
MARGIN=.35in
pandoc -t html5 -V margin-top=$MARGIN -V margin-left=$MARGIN -V margin-bottom=$MARGIN -V margin-right=$MARGIN -V papersize=letter --css ~/bin/inc/pandoc-pdf.css $1 -o $2 -s --pdf-engine=wkhtmltopdf
It does the job ok... except that sentences are mushed-together by the double spaces being removed. It makes sense that's happening because it's generating html and using css to create the pdf.
I can sorta work around that by doing a search/replace %s/ / \&nsbp;/g
and this results in better spacing... except when the line mid-paragraph begins with a new sentence, in which case the &nsbp;
character creates an unwanted space at the beginning of the line.
Does anyone have solution for this? I'd much rather avoid inserting
characters throughout my documents (and then removing them after pdf generation).
I'd even settle for a better markdown-to-pdf process without css, but I've spent several hours on that and this pdf-engine=wkhtmltopdf
+ css is the best thing I've seen thus far.
Upvotes: 1
Views: 740
Reputation: 395
Given that single-spaces after a sentence is not just a web convention but a print convention too it's highly unlikely that there will be an elegant technical solution for achieving this bad-practice of typography. So the solution in this case is easy, use proper practice of typography :)
Upvotes: 1