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

h2 id is consistently removed #11

Closed
4 tasks done
tommyvn opened this issue Sep 15, 2023 · 5 comments
Closed
4 tasks done

h2 id is consistently removed #11

tommyvn opened this issue Sep 15, 2023 · 5 comments
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on

Comments

@tommyvn
Copy link

tommyvn commented Sep 15, 2023

Initial checklist

Affected packages and versions

6.0.0

Link to runnable example

No response

Steps to reproduce

no build or bundle tools, only the specific npms required to run this bit of code.

import {unified} from 'unified'
import rehypeParse from 'rehype-parse'
import rehypeSlug from 'rehype-slug'
import rehypeSanitize from 'rehype-sanitize'
import rehypeStringify from 'rehype-stringify'

  unified()
    .use(rehypeParse)
    .use(rehypeSlug)
    .use(rehypeSanitize)
    .use(rehypeStringify)
    .processSync('<h1>foo</h1><h2>bar</h2><h3>baz</h3>')

Expected behavior

h2 to have an id:

<h1 id="user-content-foo">foo</h1>
<h2 id="user-content-bar">bar</h2>
<h3 id="user-content-baz">baz</h3>

Actual behavior

h2 does not have an id:

<h1 id="user-content-foo">foo</h1>
<h2>bar</h2>
<h3 id="user-content-baz">baz</h3>

Runtime

Node v16

Package manager

npm 8

OS

Linux

Build and bundle tools

Other (please specify in steps to reproduce)

@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 Sep 15, 2023
@wooorm
Copy link
Member

wooorm commented Sep 15, 2023

Looks a lot like syntax-tree/hast-util-sanitize#27 :)

@tommyvn
Copy link
Author

tommyvn commented Sep 16, 2023

lmao that's it.
Am I reading that correctly, that h2 is restricted to a specific id because github uses it in this way? that's wild.
anyway, this answers my question, sounds like it's a feature (for GH at least) not a bug, so i'm closing this one, I'll follow the advice on that issue to use my own schema.
thanks for the link :)

@tommyvn tommyvn closed this as not planned Won't fix, can't repro, duplicate, stale Sep 16, 2023
@github-actions

This comment has been minimized.

@wooorm wooorm added the 👀 no/external This makes more sense somewhere else label Sep 16, 2023
@github-actions

This comment was marked as resolved.

@github-actions github-actions bot added 👎 phase/no Post cannot or will not be acted on and removed 🤞 phase/open Post is being triaged manually labels Sep 16, 2023
@wooorm
Copy link
Member

wooorm commented Sep 20, 2023

Btw, if you want to help that issue along, I’m very open to a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants