August 3, 2022

Make Pandoc file conversion faster

You can try to find out why Pandoc conversion is slow by appending --trace to the command. For instance:

$ pandoc file.md -o file.pdf --trace

will print verbose of the parsing process, paragraph by paragraph, roughly.

Now, if you monitor the parsing process and notice that parsing pauses as it displays the verbose of parsing the paragraph that is on line 24, as shown there:

[trace] Parsed [Para [Str "It",Space,Str "is",Space,Str "easier",Space,Str  at line 24

it is possible that Pandoc is having a hard time parsing the paragraph which comes right after, i.e. paragraph 25.

To improve the speed of the parsing process, open the file and find what is slowing down parsing right after the paragraph line 24; a missing square bracket for example.

You can open the file directly on line 24 by running:

$ vi file.md +24

You can also use the utility time to display the time it took to execute the command. For example:

$ time pandoc file.md -o file.pdf --trace

To learn more about Pandoc, run:

$ man pandoc

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

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