Pandoc HTML Content Output

I use pandoc (not an executable on the command line, but the haskell library) and I am generating HTML output. I can not make a table of contents in the conclusion. Roughly, I have this:

... writeHtml (def {writerTOCDepth = 4, writerTableOfContents = True} m) where m = [ Header 1 ("myIdentifier",[],[]) [Str "Vulnerabilities"] , Div nullAttr otherStuff ] 

It seems to me that this is enough to get HTML output with a simple table of contents (which only has a link to the Vulnerabilities section). If someone sees what I missed, I would appreciate help.

EDIT

I believe the problem is that I need to set writerStandalone = True , but when I do this, the resulting document will be completely empty.

+5
source share
1 answer

Figured it out. You must enable offline mode and install the template:

 loadReportPandocOpts :: IO WriterOptions loadReportPandocOpts = do t <- readFile "resources/report-template.html" return def { writerTOCDepth = 4 , writerTableOfContents = True , writerHtml5 = True , writerStandalone = True , writerTemplate = t } 

And the template should look something like this:

 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="generator" content="pandoc" /> </head> <body> <div>$toc$</div> <div>$body$</div> </body> </html> 
+5
source

All Articles