Live data from Hacker News

Writing a Book with Pandoc, Make, and Vim

keleshev.com

1–10 of 61 posts

Re: Writing a Book with Pandoc, Make, and Vim

#3
post #2

To emulate the live preview, there is a neat piece of software called entr[1], from their main page, you can do something like: ls | entr make And whenever you save a change, the build is triggered and the preview is updated. [1]: http://eradman.com/entrproject/

The pipeline approach here is interesting, but it seems you'd be on your own for filtering out changes in the build directory, etc. I typically use watchexec [1] for this.

    watchexec make
By default, watchexec will filter out changes in files based on `.gitignore`.

[1]: https://github.com/watchexec/watchexec

Re: Writing a Book with Pandoc, Make, and Vim

#5
post #2

To emulate the live preview, there is a neat piece of software called entr[1], from their main page, you can do something like: ls | entr make And whenever you save a change, the build is triggered and the preview is updated. [1]: http://eradman.com/entrproject/

The pipeline approach here is interesting, but it seems you'd be on your own for filtering out changes in the build directory, etc. I typically use watchexec [1] for this. watchexec make By default, watchexec will filter out changes in files based on `.gitignore`. [1]: https://github.com/watchexec/watchexec

This is pretty good, didn't know about watchexec, but you can achieve the same by choosing carefully the command you pipe from, for example:

    ls *.md | make
Will only trigger the build if a md file is modified, which is what I think the author is interested in.

Re: Writing a Book with Pandoc, Make, and Vim

#6
pretty cool. I'm using a similar setup that allows a real-time preview of every change by means of the `entr`[1] command and gets triggered by saving the markdown.

  ls ./presentation.md |entr -c bash -c "pandoc --pdf-engine=xelatex --toc -N presentation.md -t beamer -o presentation.pdf; killall -HUP mupdf"
this would reload the pipeline and update the content of the pdf output. easy as 1-2-3 (no Makefile though which would be another step).

[1] https://www.systutorials.com/docs/linux/man/1-entr/

Re: Writing a Book with Pandoc, Make, and Vim

#7
Can you refer to figures and have the name rendered? For instance, a piece of text referring to a figure and the figure’s label will both get rendered to “Figure 2.8” regardless of paragraph edits and figures inserted or delete before it?

Re: Writing a Book with Pandoc, Make, and Vim

#8
I did this too, although the makefile presented in the article is much cleaner than mine was. Definitely recommend XeLaTeX. You're not going to get very far without unicode. I had to drop down to LaTeX often to control formatting, but Pandoc helpfully lets you do that.

Re: Writing a Book with Pandoc, Make, and Vim

#9
>It allows to move the cursor past the last character. If you insert a new character there, it is automatically padded with spaces. It is easier to see it than to explain it:

>My first programming environment was Turbo Pascal, and this is exactly how the cursor works there, which I grew accustomed to.

Holy shit! What a rush of memories reading that unlocked :)

Post reply on HN