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

TOC indentation is wonky when using MarkdownLiteral for headers #253

Open
rgobbel opened this issue Apr 26, 2023 · 0 comments
Open

TOC indentation is wonky when using MarkdownLiteral for headers #253

rgobbel opened this issue Apr 26, 2023 · 0 comments

Comments

@rgobbel
Copy link

rgobbel commented Apr 26, 2023

I'm not really sure which package this belongs to, whether it be PlutoUI, MarkdownLiteral, or CommonMark, but since the TableOfContents feature is part of PlutoUI, I'm putting it here. I love the fact that MarkdownLiteral adds automatic human-sensible IDs to header cells, but the TOC display is weird: the highlighting is gone, and the indentation is wrong in a few places.

I've attached two notebooks to show the differences, one using only the md non-standard string, and one using @mdx from MarkdownLiteral.

In the meantime I've created a simple @anchor macro to let me put custom anchors wherever I'd like. It gets the job done for me, and gives me control over exactly where the anchors are placed and what's in them. Here's the code:

Using HypertextLiteral
macro anchor(text)
    anchid = replace(lowercase(text), r"(\s)" => "-")
    @htl "<a id=\"$anchid\" href=\"#$anchid\" class=\"anchor\"></a>"
end

MDTOCNotebooks.zip

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

No branches or pull requests

1 participant