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 -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 +24

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

$ time pandoc -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. © 2016-2023 Content is licensed under CC BY-NC-SA 4.0 .