Reputation: 12139
I use pandoc in VSCode to generate HTML files from Markdown files.
I use the following htmlOptString in VSCode:
"pandoc.htmlOptString": "-s -f gfm -t html5 --template=pandoc-template.html"
I don't want to have to change that line every time I render a document.
I do not understand how I can use metadata to pass information like author, title or more, from the MD file.
For example the following does not create the $title$ variable:
---
title: test
...
In my template the title element id rendered as empty
<title>$title$</title>
How do I create variables from the markdown file?
I also tried using a YAML metadata file to no effect.
I tried specifying the yaml_metadata_block
extension in the pandoc command
My new htmlOptString is:
"pandoc.htmlOptString": "-s --from=gfm+yaml_metadata_block -t html5 --template=pandoc-template.html"
When I run the command from a terminal the result is the same, i.e. the title block is rendered in HTML and no $title$ variable is generated.
Upvotes: 3
Views: 2191
Reputation: 22609
Pandoc added support for this in version 2.13 (released on 2021-03-21). Nowadays, it should be enough to update to the latest version for this to work.
Upvotes: 2