Do not expose arbitrary HTML ids from Markdown headings
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
A markdown cell with the content "# xyz" will create HTML of the form <h1 id="xyz"> ....</h1> if there is more than one word, the id will use hyphens in place of spaces.
This can lead to very surprising problems when a use chooses a heading word that is used as an id by another javascript/HTML component for their own purposes.
This was the case with Bokeh, see https://github.com/bokeh/bokeh/issues/10002#issuecomment-654810980
I think it is a dangerous practice in general to use this approach which can result in arbitrary ids without any jupyter specific prefix. Especially in notebooks about some other library (like Bokeh) it can easily happen that such a library specific id is mentioned in a heading. Of course all libraries should have some convention to prevent clashes of ids (and class names).
I think this is related to, but different from #1899
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by locating the Markdown-to-HTML heading renderer and reproduce the # xyz case, then inspect the related #1899 discussion. Done means heading IDs no longer create arbitrary collisions with notebook or library HTML/JavaScript IDs, with regression coverage for the reported Bokeh-style case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jupyter-notebook, markdown
- Domain
- content, frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100