[Bug report] reloading markdown language will add wrap hook multiple times
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13k
- Forks
- 1.4k
- Avg merge
- 15h 36m
- Merged PRs (30d)
- 3
Description
Information:
- Prism version: 1.23.0
- Plugins: 'none'
- Environment: Node
Description
The reload logic is described here:
So the prism-markdown is possible to be reloaded multiple times, and the wrap hook will be added multiple times, too:
For example:
- Load
markdownandjavascript - Load
jsdocjsdocmodifiesjavascriptjavascriptmodifiesmarkupmarkupis depended bymarkdown
- So
javascript,markupandmarkdownwill also be reloaded
Then, syntax highlighting inside markdown code block will be triggered multiple times.
Example
- I tried to highlight markdown code:

- The
wraphooks are:

- Then the highlighted code:


Contributor guide
No contributing guide indexed for this repository
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
Start with the reload logic in dependencies.js at the linked lines, then inspect the wrap hook registration in components/prism-markdown.js. Reproduce the markdown, javascript, and jsdoc reload sequence described in the issue; done means reloading dependencies does not register duplicate hooks or trigger repeated highlighting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100