Disable a bunch of markdown rules

Most were unused, there were a times where "..." was being transformed to a single ellipse character.
And I used strikethrough once, but that's dumb
This commit is contained in:
MatthiasSaihttam 2021-05-02 20:51:37 -04:00
parent fe01d3913f
commit 0583ee40f0
1 changed files with 9 additions and 4 deletions

View File

@ -112,11 +112,16 @@
}
}).use(remarkable.linkify);
// Allow data: URIs for images, from https://github.com/jonschlinkert/remarkable/issues/329
const originalLinkValidator = md.inline.validateLink;
const dataLinkRegex = /^\s*data:([a-z]+\/[a-z]+(;[a-z-]+=[a-z-]+)?)?(;base64)?,[a-z0-9!$&'',()*+,;=\-._~:@/?%\s]*\s*$/i;
// I'm leaving in "references", which handles the convention of putting your links at the bottom of your post
md.core.ruler.disable(["abbr", "abbr2", "footnote_tail", "replacements"]);
md.block.ruler.disable(["hr", "footnote", "heading", "lheading", "table", "htmlblock"]);
md.inline.ruler.disable(["del", "ins", "mark", "sub", "sup", "footnote_inline", "footnote_ref", "htmltag", "entity", "autolink"]);
md.inline.validateLink = (url) => originalLinkValidator(url) || url.match(dataLinkRegex);
//Images are parsed as inline links, so we can't turn off parsing,
//but we can overwrite the renderer so they never get displayed. Not ideal
/*md.renderer.rules.image = function () {
return "";
};*/
for (let el of els) {
const extendedText = el.querySelector(".extended-text");