Thanks to your suggestion, I set up Panflute and found an example in the documentation for generating a table of contents: http://scorreia.com/software/panflute/guide.html#globals-and-backmatter Unfortunately, I don't know very much about Python, and I ran into some trouble modifying the example. I was trying to add markdown to generate an internal link. item = ListItem(Plain(*elem.content)) doc.toc.content.append(item) What I wanted to do is to modify elem.content (the heading that will be displayed in the table of contents) by adding markdown so that it becomes an internal link. I tried to treat it is a string, but that didn't work because it is a list container. How can I treat the list container into a string? I found that if I can convert the list container into a string, I can modify it and send it back like this: item = ListItem(Plain(Str('[Introduction][#introduction]'))) On Sunday, April 21, 2019 at 5:41:16 AM UTC+9, Kolen Cheung wrote: > > You could write a pandoc filter to get the links. If you use python then > try looking at Panflute on GitHub for its user guide. > > To generate the markdown in other markdowns, you can use pandoc -t ... > option, both markdown you mentioned are supported. See pandoc Manual for > details. It will try to represent feature not present in the target > markdown by its closest representation (sometimes HTML, or in the case of > footnote a “pseudo” footnote that looks like a footnote.) You should try to > see if it works in your case though. > > If it doesn’t work than in the filter you may add custom ID per header you > need and then create links to those directly. -- 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4b52e6cb-df57-4436-97b3-49351cc1300d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.