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

Add option for adding a prefix #14

Closed
4 tasks done
onyxcodes opened this issue Oct 27, 2022 · 3 comments · Fixed by #15
Closed
4 tasks done

Add option for adding a prefix #14

onyxcodes opened this issue Oct 27, 2022 · 3 comments · Fixed by #15
Labels
💪 phase/solved Post is done

Comments

@onyxcodes
Copy link
Contributor

Initial checklist

Problem

I thought it would be useful to be able to add a prefix to the generated slugs.
Had the case where on the same page there were multiple instances of rehype and I needed to make sure each slug generated, was unique throughout the page and prefixing them with an id related to the instance solved the problem.

Solution

Since I needed this feature, I've made a fork: 82d837c

Alternatives

I'm not sure there any alternatives, maybe adding some hidden content to the headings? Correct me if I'm wrong..

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Oct 27, 2022
@wooorm
Copy link
Member

wooorm commented Oct 27, 2022

See #13.
Your case is interesting and different though.

GH does some things like this for footnotes in comments (which are numbered, so, #fn-1). Where they prefix with a hash of the comment.
They never render headings with IDs from different sources on the same page though.

Interested in PRing the feature to this project?

@onyxcodes
Copy link
Contributor Author

I'm not sure about the GH case you are talking about (care to point it out)?

Anyway, I'll open a PR.

wooorm added a commit that referenced this issue Oct 31, 2022
Related-to: GH-13.
Closes GH-14.
Closes GH-15.

Reviewed-by: Titus Wormer <tituswormer@gmail.com> 

Co-authored-by: Titus Wormer <tituswormer@gmail.com>
@github-actions

This comment has been minimized.

@wooorm wooorm added the 💪 phase/solved Post is done label Oct 31, 2022
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

Successfully merging a pull request may close this issue.

2 participants