File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed
src/node/markdown/plugins Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change 11import type MarkdownIt from 'markdown-it'
22
33export 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
138 }
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 )
1810 }
1911}
You can’t perform that action at this time.
0 commit comments