Search code examples
javascripthtmlcommand-lineincludepandoc

Including a javascript file with pandoc when going from markdown to html


I am using pandoc to convert a markdown file to standalone html file. I have css file that I include with the -c command-line option. I would like to do the same thing with a javascript file, but I have not found an option to include script files similar to the -c option.

Is there such an option? If not, what is the most efficient way to do the inclusion?


Solution

  • Use the header-includes variable in the YAML metadata header (and run pandoc -s):

    ---
    header-includes: <script src="foo"></script>
    ---
    
    my markdown document