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

Feature: Automatically add an ID to headings (for dynamic TOC/ anchors) #85

Open
mohits opened this issue Jan 23, 2024 · 2 comments
Open

Comments

@mohits
Copy link
Contributor

mohits commented Jan 23, 2024

Hi, I am using a theme with Jekyll that automatically uses JS to create a table of contents (TOC) to have anchors within the page. This requires that each heading have an ID.

RedCloth can add an ID to a heading if you provide one. I'm trying to see if this could be done automatically for all headings. On my PC, I have made a small change that makes it work - it adds an ID automatically if there isn't one provided.

(1) Would there be interest to merge this upstream?
(2) I want to see if I can put this behind a configuration so that the default works the same unless you specify auto_heading_ids but right now, I have not got far enough into the code to be sure that it works. It would be great if you point me to something.

If there is interest, then I can try to make this available and add a spec for the ability.

@heliocola
Copy link
Collaborator

@mohits : thanks for opening this. See below my answers:

(1) Would there be interest to merge this upstream?

I am yet not a heavy user of this gem like you and others that have opened issues and PR in the past several years, but if you think this will add value I am open to work with you.

(2) I want to see if I can put this behind a configuration...

I think that is a good idea to keep backward compatibility, but again I am not very familiar with the gem.

I also want to tackle #49 and #19, so maybe the configuration will help us have a better migration path for that as well.

I will focus on some cleanups I want to do, since the last release, release a new version, work to merge #83 , and I think that will give you some time to get your machine up & running!
So,

@mohits
Copy link
Contributor Author

mohits commented Jan 24, 2024

Thanks @heliocola for all your work on this.

I managed to figure out what is needed to support it behind a configuration (and the downstream changes in the jekyll-textile-converter gem that integrates RedCloth with Jekyll), so I can definitely get this done. I will slowly work on getting the spec and other things prepared for a PR while also getting my VM up and running to get back to what I had started.

I think I now know how to add config flags into RedCloth and can see if that can be extended to #49 and #19,

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

2 participants