mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Reimplement MD033/no-inline-html using micromark tokens.
This commit is contained in:
parent
08b31da0aa
commit
48a92d41a4
6 changed files with 171 additions and 200 deletions
|
|
@ -193,19 +193,6 @@ module.exports.escapeForRegExp = function escapeForRegExp(str) {
|
|||
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
||||
};
|
||||
|
||||
// Un-escapes Markdown content (simple algorithm; not a parser)
|
||||
const escapedMarkdownRe = /\\./g;
|
||||
module.exports.unescapeMarkdown =
|
||||
function unescapeMarkdown(markdown, replacement) {
|
||||
return markdown.replace(escapedMarkdownRe, (match) => {
|
||||
const char = match[1];
|
||||
if ("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~".includes(char)) {
|
||||
return replacement || char;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the string representation of a fence markup character.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue