diff --git a/package.json b/package.json index 72744dc7..8f1ba77a 100644 --- a/package.json +++ b/package.json @@ -76,6 +76,7 @@ "eslint-plugin-flowtype": "8.0.3", "eslint-plugin-import": "2.25.3", "prettier": "^2.5.1", + "prettier-plugin-tailwindcss": "^0.1.4", "typescript": "^4.5.5", "webpack": "^5.67.0" } diff --git a/remark/prism-diff-highlight.js b/remark/prism-diff-highlight.js index 31bdf229..344a808f 100644 --- a/remark/prism-diff-highlight.js +++ b/remark/prism-diff-highlight.js @@ -1,7 +1,8 @@ // https://github.com/PrismJS/prism/blob/master/plugins/diff-highlight/prism-diff-highlight.js module.exports = (Prism) => { var LANGUAGE_REGEX = /diff-([\w-]+)/i - var HTML_TAG = /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/gi + var HTML_TAG = + /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/gi //this will match a line plus the line break while ignoring the line breaks HTML tags may contain. var HTML_LINE = RegExp( /(?:__|[^\r\n<])*(?:\r\n?|\n|(?:__|[^\r\n<])(?![^\r\n]))/.source.replace(/__/g, function () { diff --git a/remark/utils.js b/remark/utils.js index 5183fd96..5eff169e 100644 --- a/remark/utils.js +++ b/remark/utils.js @@ -3,7 +3,8 @@ const loadLanguages = require('prismjs/components/') loadLanguages() require('./prism-diff-highlight')(Prism) -const HTML_TAG = /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/gi +const HTML_TAG = + /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/gi const PSEUDO_CLASSES = [ 'active', 'any-link', diff --git a/remark/withSyntaxHighlighting.js b/remark/withSyntaxHighlighting.js index 9394e3d7..083537ac 100644 --- a/remark/withSyntaxHighlighting.js +++ b/remark/withSyntaxHighlighting.js @@ -17,7 +17,9 @@ module.exports.withSyntaxHighlighting = () => { if (node.lang !== null) { node.type = 'html' node.value = [ - `