-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Bug report] reloading markdown language will add wrap hook multiple times #2716
Copy link
Copy link
Open
Description
Information:
- Prism version: 1.23.0
- Plugins: 'none'
- Environment: Node
Description
The reload logic is described here:
Lines 383 to 388 in 4e7b2a8
| // add components to reload | |
| // A component x in `loaded` has to be reloaded if | |
| // 1) a component in `load` modifies x. | |
| // 2) x depends on a component in `load`. | |
| // The above two condition have to be applied until nothing changes anymore. |
So the prism-markdown is possible to be reloaded multiple times, and the wrap hook will be added multiple times, too:
prism/components/prism-markdown.js
Line 320 in 4e7b2a8
| Prism.hooks.add('wrap', function (env) { |
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:
Reactions are currently unavailable



