-
-
Notifications
You must be signed in to change notification settings - Fork 399
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
Generate HTML identifier from section title #996
Comments
You can change the generated html with http://docs.qownnotes.org/en/develop/scripting/README.html#notetomarkdownhtmlhook. To set anchors as you like... |
It could, but it would not be very practical, since I would have to run regexp after regexp. I think it could be better suited for a patch to the HTML generator. Could you direct me to the code, unless it is from an |
It's a 3rd party library: https://github.com/pbek/QOwnNotes/tree/develop/src/libraries/hoedown |
Ha, nice! markdown-it even has a plugin for header anchors already. I'll have a look at integrating it and close this issue, thank you. |
great! |
@toindev - Did you figure out how to use this for TOC-style links within a given note? I tried using markdown-it, but still didn't get quite what I was looking for. |
Oh, I see now (#1567) that the markdown engine(?) has been changed to https://github.com/mity/md4c . Maybe this issue is now moot. |
So can you link to sections? 🤔 |
I actually couldn't quite figure out how to link to sections directly. I was expecting something like this to work:
But I could only get it to work with the link formatted something like: I thought switching to MD4C would fix it, but alas, I couldn't make it work. I tired with the For now, I'm going to use VSCodium, so this isn't a pressing issue for me. (I'm often coding, so I will usually have VSCode open already anyway, and at least on my system (Fedora) the RAM footprint was about the same). But I'm happy to continue engaging/working on this Issue if there's anything I can do. I appreciate all the work you've put into QOwnNotes and love to see tools like this continue to be successful - especially ones that integrate so well into the self-hosted ecosystem! |
yes, this is the way 😁 |
Expected behaviour
I can link to a specific section in a exported HTML document using an identifier generated from its title.
eg.
<h4 id="my-section">My section</h4>
in generated html, in order to be able to usemy_note.html#my-section
to access "My section"Actual behaviour
The identifier for sections exist, but are numerically incremented, and do not reflect the title of the section.
example:
<h4 id="toc_6">My section</h4>
Possible implementation
This is how it's done in the insert-toc script, in order to work well with GitHub flavored Markdown:
The text was updated successfully, but these errors were encountered: