-
-
Notifications
You must be signed in to change notification settings - Fork 556
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
Automatically generate ids for headers #364
Comments
I'm not dead-set against adding extensions here; after all, we have smart quotes. |
This is not a show-stopper in my use case, but I feel it would be useful to allow elements to have id's since both HTML and XML allow any element to have an id. Rather than generating these automatically, how about adding APIs to
Then it would be simple for an application to traverse the parse tree prior to rendering, say, to generate a table of contents, looking for interesting nodes to reference, not necessarily headings. Furthermore using this approach, the ids can be generated by and meaningful to the appplication. |
I have forked a proof of concept at https://github.com/iarthair/cmark on the branch node-id-api. I'll post a simple program that uses it later, my test case was a hack to a larger application. I have an equivalent patch for cmark-gfm which I'll deal with in due course. There's a few issues to sort, mainly it's only done for HTML and the id attribute is written out in the "wrong" function. Perhaps this is the way to go? |
I know that this issue was not yet resolved in the spec, but it could potentially be done in an implementation-specific way that does not violate the spec. This is a very useful feature and has been requested both on the forum and elsewhere (see e.g.: github#186).
Would it be in scope to add such an extension to cmark? Is this better sent to a forked implementation like cmark-gfm?
The text was updated successfully, but these errors were encountered: