File tree 1 file changed +5
-13
lines changed
src/node/markdown/plugins
1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change 1
1
import type MarkdownIt from 'markdown-it'
2
2
3
3
export function restoreEntities ( md : MarkdownIt ) : void {
4
- md . core . ruler . before ( 'text_join' , 'entity' , ( state ) => {
5
- for ( const token of state . tokens ) {
6
- if ( token . type !== 'inline' || ! token . children ) continue
7
-
8
- for ( const child of token . children ) {
9
- if ( child . type === 'text_special' && child . info === 'entity' ) {
10
- child . type = 'entity'
11
- }
12
- }
4
+ md . core . ruler . disable ( 'text_join' )
5
+ md . renderer . rules . text_special = ( tokens , idx ) => {
6
+ if ( tokens [ idx ] . info === 'entity' ) {
7
+ return tokens [ idx ] . markup // leave as is so Vue can handle it
13
8
}
14
- } )
15
-
16
- md . renderer . rules . entity = ( tokens , idx ) => {
17
- return tokens [ idx ] . markup // leave as is so Vue can handle it
9
+ return md . utils . escapeHtml ( tokens [ idx ] . content )
18
10
}
19
11
}
You can’t perform that action at this time.
0 commit comments