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

Automagically add unique id attributes to HTML headings #95

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

caribpa
Copy link

@caribpa caribpa commented May 11, 2022

Hi there!

This PR adds the option to automatically generate id attributes for the HTML headings by setting the :generate_heading_id option to true.

I am aware that #68 tries to do a similar thing, but it uses a <span> inside the heading instead of adding the id attribute to the heading itself, like this PR achieves.

The ids of subheadings are generated based on the ids of those above it, trying to preserve uniqueness.

In a nutshell, this:

* Hello
** World

Gets converted into:

<h1 id="hello">Hello</h1>
<h2 id="hello--world">World</h2>

This PR also adds the -i flag to the org-ruby tool to enable this behavior.

Let me know what you think 😁

@sangwoo-joh
Copy link

Thank you so much. Even though this commit has not been merged into the master branch yet, I personally use this feature gratefully.

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

Successfully merging this pull request may close these issues.

2 participants