-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build/regression): markdown backslash escapes not working
closes #3808
- Loading branch information
Showing
2 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type MarkdownIt from 'markdown-it' | ||
|
||
export function restoreEntities(md: MarkdownIt): void { | ||
md.core.ruler.before('text_join', 'entity', (state) => { | ||
for (const token of state.tokens) { | ||
if (token.type !== 'inline' || !token.children) continue | ||
|
||
for (const child of token.children) { | ||
if (child.type === 'text_special' && child.info === 'entity') { | ||
child.type = 'entity' | ||
} | ||
} | ||
} | ||
}) | ||
|
||
md.renderer.rules.entity = (tokens, idx) => { | ||
return tokens[idx].markup // leave as is so Vue can handle it | ||
} | ||
} |