I'm using pandoc (not the executable on the command line but the haskell library), and I'm generating HTML output. I cannot make the table of contents appear in the output. Roughly, I have this:
...
writeHtml (def {writerTOCDepth = 4, writerTableOfContents = True} m)
where m =
[ Header 1 ("myIdentifier",[],[]) [Str "Vulnerabilities"]
, Div nullAttr otherStuff
]
I feel like this alone should be sufficient to get HTML output with a simple table of contents (one that has only a link to the Vulnerabilities section). If anyone sees what I've missed, I would appreciate the help.
EDIT
I believe that the issue is related to me needing to set writerStandalone = True
, but when I do this, the resulting document is completely blank.
Figured it out. You have to turn on standalone mode and set a 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With