mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Improve handling of nested tags and blocks by MD033/no-inline-html (fixes #179).
This commit is contained in:
parent
44fac78721
commit
4c7ffdd335
7 changed files with 372 additions and 18 deletions
|
@ -115,6 +115,19 @@ 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;
|
||||
});
|
||||
};
|
||||
|
||||
// Returns the indent for a token
|
||||
function indentFor(token) {
|
||||
const line = token.line.replace(/^[\s>]*(> |>)/, "");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue