diff --git a/examples/scripts/index-demo.js b/examples/scripts/index-demo.js index e7c0839a..0e9c1295 100644 --- a/examples/scripts/index-demo.js +++ b/examples/scripts/index-demo.js @@ -145,6 +145,9 @@ var basicConfig = { customResourceURL: 'https://github.githubassets.com/images/icons/emoji/unicode/${code}.png?v8', upperCase: false, }, + // htmlBlock: { + // filterStyle: true, + // } // toc: { // tocStyle: 'nested' // } diff --git a/src/core/hooks/HtmlBlock.js b/src/core/hooks/HtmlBlock.js index 41229e64..de4b5d63 100644 --- a/src/core/hooks/HtmlBlock.js +++ b/src/core/hooks/HtmlBlock.js @@ -100,7 +100,8 @@ export default class HtmlBlock extends ParagraphBase { $str = $str.replace(/\$#60;/g, '<').replace(/\$#62;/g, '>'); // 过滤HTML标签的style属性 if (this.filterStyle) { - $str = $str.replace(/<([^/][^>]+?) style="[^"]+"([^>]*)>/gi, '<$1$2>'); + $str = $str.replace(/<([^/][^>]+?) style="[^>\n]+?"([^>\n]*)>/gi, '<$1$2>'); + $str = $str.replace(/<([^/][^>]+?) style='[^>\n]+?'([^>\n]*)>/gi, '<$1$2>'); } return $str; }