July 13, 2023

Show paragraph count on pdf document compiled with Pandoc

To show paragraph count on a pdf compiled with Pandoc, first download the lua script count-para.lua (there is a copy of the script hosted on this website) by running:

$ wget https://yctct.com/count-para.lua

Then, when converting a file from Markdown to pdf, to show paragraph count add --lua-filter=path/to/file/count-para.lua as an option:

$ pandoc -o file.pdf file.md --lua-filter=path/to/file/count-para.lua  

If the file containing the script count-para.lua is located in the same directory as the file you wish to count words of, you can run:

$ pandoc -o file.pdf file.md --lua-filter=count-para.lua

A number in brackets should be displayed next to each paragraph on a pdf.

If you need to download Pandoc, on Trisquel GNU/Linux run:

$ sudo apt install pandoc

command-line interface (cli) personal computing pandoc trisquel GNU linux text processing office applications wiki shell literacy offline

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88