-
Notifications
You must be signed in to change notification settings - Fork 56
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
Table of contents / Automatic enumeration of Markdown headers? #51
Comments
For anyone who wants to take this on: This can be done entirely inside a Pluto notebook - we don't need to modify Pluto itself. I think this should be a Try this: md"# Hello" md"# World!" html"""
<script>
const headers = Array.from(
document.querySelectorAll(
"pluto-notebook pluto-output h1"
)
)
return html`<ul>${headers.map(h1 =>
html`<li>${h1.innerText}</li>`
)}</ul>`
</script>
""" Up to you to figure out how |
Notice that in my example headers of any level get linked, not just |
pluto-cell id can be used to link
But I guess this is not reactive as its html 😕 |
Cool! Maybe you could add the cell_output_changed event to the |
Welcomeeeee to this now fancy thread in PlutoUI 🎉 I made it work with a hybrid event/mutation observer solution, but then @Pocket-titan inspired me to use mutation observer all the way down (it is possible anyway). Right now it only links to cells, but it does index all cells. It uses one mutation observer to track when cells are added or removed, and then it uses a second mutation observer to track changes inside the output. Removes the need for fonsp/Pluto.jl#445 :) |
(Doesn't work on current Pluto release (the notebook link runs on my branch with javascript enhancements) but this will work in couple of days) |
Let's combine this into the PR? @dralletje Here's a fix for the CSS counters: |
I will... TOMORROW |
I had to search for the PR for some reason. Sparing the next person 0.5 seconds: it's #30. :) |
Close? |
#30 thanks! |
Hi all, I've been trying to follow the discussions in this and related issues, and am a bit confused. Did you guys decide to have the notebook author manually input the header/section numbers? Or has this been automated? |
@kapple19 - Hopefully you've figured it out by now, but in case anyone is curious: using PlutoUI
TableOfContents() PlutoUI exports a function |
Hi there,
I use Jupyter (specifically Jupyter Lab) to make project reports every 3 months or so. As a result, the reports get quite large. I structure them in detail with markdown headers and sections. Jupyter provides an excellent extension, called simply "table of contents" that does two things:
Example:
Is this possible to be done in Pluto.jl? Is it planned?
The text was updated successfully, but these errors were encountered: