Is there a way, during the calling of files (I'm using a catchall -- ./md/*.md) to extract the document title? I can snag the TOC with a template like you said, but it's got links to things in the current document (<li><a href="#link-to-heading">Actual Heading Name</a></li>.) I'm trying to pull in separate files, but leave them separate, so if my bash for loop, I was going to echo $filename and $titlename (if I can get $titlename somehow form pandoc)


On Thursday, November 17, 2022 at 12:12:04 PM UTC-5 BP wrote:
Create a template with only the ToC generating stuff:

``````html
<nav id="$idprefix$TOC" role="doc-toc">
$if(toc-title)$
<h2 id="$idprefix$toc-title">$toc-title$</h2>
$endif$
$table-of-contents$
</nav>
``````

or just the last line but one if you don't want the nav element and title. Save that to something like `gen-toc.html` and invoke pandoc with `--template=gen-toc.html` added. You might want to place the template in the templates subdirectory of your pandoc user directory (both of which you may have to create; see `pandoc --help` for where) so that you can use it from anywhere.




Den tors 17 nov. 2022 17:49Craig Parker <craig.f...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Is there a way to generate JUST a table of contents? I can probably hack up a file with bash after the fact, but didn't know if there was a way to redirect TOC content to another html file.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/14f84699-724f-4483-8fe6-1845d1fe81b5n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/f4eeaee3-78b4-4cae-b77f-5b858a8d9709n%40googlegroups.com.