diff --git a/packages/core/src/engines/javascript.ts b/packages/core/src/engines/javascript.ts index 69592cfd2..32dd39102 100644 --- a/packages/core/src/engines/javascript.ts +++ b/packages/core/src/engines/javascript.ts @@ -25,6 +25,8 @@ export class JavaScriptScanner implements PatternScanner { try { const regex = onigurumaToRegexp( p + .replace(/\|\\G(\||\))/g, '$1') + .replace(/(\(|\|)\\G\|/g, '$1') // YAML specific handling; TODO: move to tm-grammars .replaceAll('[^\\s[-?:,\\[\\]{}#&*!|>\'"%@`]]', '[^\\s\\-?:,\\[\\]{}#&*!|>\'"%@`]'), { diff --git a/packages/shiki/test/engine-js/__records__/markdown.json b/packages/shiki/test/engine-js/__records__/markdown.json new file mode 100644 index 000000000..1507f105f --- /dev/null +++ b/packages/shiki/test/engine-js/__records__/markdown.json @@ -0,0 +1,733 @@ +[ + { + "constractor": [ + [ + "(^|\\￿)[ ]{0,3}([\\*\\-\\_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?", + "(?:^|\\￿)[ ]{0,3}(#{1,6}\\s+(.*?)(\\s+#{1,6})?\\s*)$", + "(^|\\￿)[ ]{0,3}(>) ?", + "(^|\\￿)([ ]{0,3})([*+-])([ \\t])", + "(^|\\￿)([ ]{0,3})(\\d+[\\.\\)])([ \\t])", + "(^|\\￿)(\\s*)(`{3,}|~{3,})\\s*(?i:(markdown|md)((\\s+|:|,|\\{|\\?)[^`]*)?$)", + "(^|\\￿)(\\s*)(`{3,}|~{3,})\\s*(?=([^`]*)?$)", + "(^|\\￿)([ ]{4}|\\t)", + "\\s*(\\[)([^]]+?)(\\])(:)[ \\t]*(?:(<)((?:\\\\[<>]|[^<>\\n])*)(>)|(\\S+?))[ \\t]*(?:((\\().+?(\\)))|((\").+?(\"))|((').+?(')))?\\s*$", + "(^|\\￿)\\s*(