Repository navigation
fix: prefix raw HTML ids without doubling footnote clobber prefixes - #695
Merged
farnabaz merged 3 commits intoOct 23, 2026
Merged
Conversation
Contributor
|
@umeraamir69 is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
✅ All commits are signedAll 3 commit(s) in this pull request have a verified signature. Thanks! Checked at 60e78cd. |
Restore user-content- on rehype-sanitize so raw ids cannot clobber window, then strip the doubled prefix on ids remark-rehype already prefixed. Co-authored-by: Muhammad Umer Aamir <93091750+umeraamir69@users.noreply.github.com>
farnabaz
force-pushed
the
fix/sanitize-clobber-prefix-raw-html-ids
branch
from
October 23, 2026 11:22
155a41c to
362601d
Compare
| export const defaultRehypePlugins: Record<string, Pluggable> = { | ||
| raw: rehypeRaw, | ||
| sanitize: [rehypeSanitize, defaultSanitizeSchema], | ||
| undoubleClobberPrefix: rehypeUndoubleClobberPrefix, |
Contributor
Contributor
Author
|
Thanks for the merge farnabaz. Glad 695 landed today. I prefixed raw HTML ids after rehype-sanitize dropped clobberPrefix, and I left the footnote user-content- prefix alone so it wouldn't double on issue 694. Ping me if a custom sanitize pipeline still misses a target. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #694.
rehype-sanitizewas givenclobberPrefix: ""so footnote ids fromremark-rehypewould not becomeuser-content-user-content-fn-1. That also left raw HTML ids unprefixed, so<div id="clobbered">becamewindow.clobbered.This restores the default
user-content-prefix on sanitize, then a small rehype plugin strips the doubled prefix on ids thatremark-rehypealready prefixed. Footnotehrefs stay aligned with their targets. Raw HTML ids become#user-content-…. Customsnippettag tests now expect the prefixed id.Test plan
vitest runon footnotes, allowed-tags, and custom-tag-markdown#user-content-fn-1<div id="clobbered">does not setwindow.clobbered