Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Can Weave include a Table of Contents in the HTML output #420

Open
00krishna opened this issue Apr 21, 2021 · 3 comments
Open

[FR] Can Weave include a Table of Contents in the HTML output #420

00krishna opened this issue Apr 21, 2021 · 3 comments

Comments

@00krishna
Copy link

description

This is more of a question than a request. But I was wondering if it is possible to include a table of contents in the HTML outputs from the weave() command? This way it is easier to navigate around a document and see the sections, instead of manually scrolling.

I checked other issues and there was a reference to someone asking for control of the table of contents from pandoc_options, however in looking at the documentation I did not see any explanation about using pandoc_options for setting the table of contents. I saw that pandoc_options was mentioned, but it was not really elaborated on.

Hence, I was just wondering if there is a way to include a TOC or if there is an example of include a TOC that I can emulate. Thanks.

@vjd
Copy link

vjd commented Apr 21, 2021

you can already include table of contents by passing in pandoc_options=[] where you can pick most options from https://pandoc.org/MANUAL.html#options I think

weave("./test.jmd", doctype="pandoc2html", pandoc_options = ["--toc", "--toc-depth= 3", "--number-sections", "--self-contained"])

However, It would be nice if the pandoc2html output format could keep the julia syntax highlighting and not break the table rendering as seen in the default html output.

@00krishna
Copy link
Author

@vjd Oh this is very helpful. Yeah, I see how the pandoc options work now. I tested it out and the syntax highlighting seems to work for me. I wonder if that is simply a matter of including some library in the header of the HTML file. Hmm, there must be a way to include that either through Weave.jl or through some script to add the library to the HTML file that comes out of Weave?

@xgdgsc
Copy link
Contributor

xgdgsc commented Mar 24, 2022

With the same pandoc options as #420 (comment) I don' t get toc, what could be the reason?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants