Skip to content

Using yaml inside a Div for custom HTML printing #10334

Answered by fiapps
TheoWinterhalter asked this question in Q&A
Discussion options

You must be logged in to vote

If you want to have something in a Markdown document that should be parsed as something other than Markdown, the best strategy to put it in a code block. Code blocks can have classes, so you can give the code block a paper class and look for a CodeBlock with that class in the filter. Then your filter can get the unparsed text of the code block and parse it in an appropriate way. In the filter, you can use pandoc.json to parse the text as JSON or pandoc.read() to produce an AST from any format pandoc can parse, including a Markdown document that contains only a YAML block. JSON is convenient if you just want strings to insert in your template (pandoc,json.decode(block.text, false)). A YAML…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by TheoWinterhalter
Comment options

You must be logged in to vote
2 replies
@fiapps
Comment options

@TheoWinterhalter
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants