-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
IDs of headings with inline tokens (link, em, bold...) #450
Comments
That is default behavior, you can overwrite heading with function(text, level, raw) { return '<h' + level + '>' + text + '</h' + level + '>\n';};" |
I've already overridden the renderer, but the problem is the |
+1 |
See #981 |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was working recently about headings' ids and I encountered something like:
Here on github, clean segment links are generated, which only include the "raw" visible part of the heading text, as you can see in this gist.
Now,
marked
with default options returns this:As you can see, the ids are quite "dirty", as they are generated from the raw markdown code of the heading (see code). Some markdown punctuation is crushed into dashes, but more complex tokens like links have additional text in them, which makes its way to the segment link.
I wonder if you would be interested in "fixing" this, as I believe it would require some many LOCs.
My idea was that we could create a function like
inline.output
, that only returns the textual part of the rendered markdown. The return value of this function would be passed as theraw
argument of the heading renderer.I am available to submit a PR in a week.
The text was updated successfully, but these errors were encountered: