the attached toc.lua might be helpful (please see the comments at the top of the file: this is a fragment extracted from an HTML writer that also does some other things, so you'll have to delete some sections, but it should be easily adaptable); cheers, w. On Fri, 25 Mar 2022 at 02:30, John MacFarlane wrote: > Hoàng-Ân Lê writes: > > > Well, I trust in the "that is very similar to that of pandoc's HTML > > writer". So I was confused when it's not that similar. I actually had to > > come up with all the elements that I thought could be different and went > on > > to manually check the generated code one by one. > > > > Could you elaborate how TOC and Mathjax could be done? > > With math, it should be fine as it is, as long as your > template sets up mathjax to parse math between \(..\) and > \[..\] delimiters. > > Pandoc's HTML writer inserts a snippet into the HTML header > (where the $math$ variable is) that loads mathjax and sets > appropriate options. You can have your custom writer set > the math variable to something appropriate. > See https://pandoc.org/custom-writers.html#template-variables > > The TOC is more complex. You'd have to construct it yourself > programatically. For example, you could build a Lua table > and add to it every time you encounter a Header element. > Then, in the Doc function, construct an HTML TOC based > on this table, and add it to the document body. I can't > go into more detail -- if this is enough to get you started, > great. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/m2fsn6ix1n.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net > . > -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxhi%3Dr9L8CxbimMiLYmLSP9A4hm7bg%3D9S0jg_0k-vibaKA%40mail.gmail.com.