Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enable html preprocessing (#1529)
* feat: enable html preprocessing * allow custom unescape override
- Loading branch information
1 parent
3f26db0
commit c840421
Showing
7 changed files
with
61 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,18 @@ | ||
const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g; | ||
|
||
const htmlEntities = { | ||
'&': '&', | ||
'&': '&', | ||
'<': '<', | ||
'<': '<', | ||
'>': '>', | ||
'>': '>', | ||
''': "'", | ||
''': "'", | ||
'"': '"', | ||
'"': '"', | ||
}; | ||
|
||
const unescapeHtmlEntity = (m) => htmlEntities[m]; | ||
|
||
export const unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity); |
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