From f0e62b0f6b97a9cc1c15d44502520daa9dd0f9cd Mon Sep 17 00:00:00 2001 From: Osip Fatkullin Date: Wed, 22 Jul 2020 13:57:18 +0300 Subject: [PATCH] EditorConfig: Fix #2472 --- components/prism-editorconfig.js | 8 ++++++-- components/prism-editorconfig.min.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/prism-editorconfig.js b/components/prism-editorconfig.js index 5cab128ca6..c7c68b0460 100644 --- a/components/prism-editorconfig.js +++ b/components/prism-editorconfig.js @@ -2,7 +2,8 @@ Prism.languages.editorconfig = { // https://editorconfig-specification.readthedocs.io/en/latest/ 'comment': /[;#].*/, 'section': { - pattern: /^[ \t]*\[.+]/m, + pattern: /(^[ \t]*)\[.+]/m, + lookbehind: true, alias: 'keyword', inside: { 'regex': /\\\\[\[\]{},!?.*]/, // Escape special characters with '\\' @@ -10,7 +11,10 @@ Prism.languages.editorconfig = { 'punctuation': /[\[\]{},]/ } }, - 'property': /^[ \t]*[^\s=]+(?=[ \t]*=)/m, + 'property': { + pattern: /(^[ \t]*)[^\s=]+(?=[ \t]*=)/m, + lookbehind: true + }, 'value': { pattern: /=.*/, alias: 'string', diff --git a/components/prism-editorconfig.min.js b/components/prism-editorconfig.min.js index 58fdfdf71e..fd7ddd72c4 100644 --- a/components/prism-editorconfig.min.js +++ b/components/prism-editorconfig.min.js @@ -1 +1 @@ -Prism.languages.editorconfig={comment:/[;#].*/,section:{pattern:/^[ \t]*\[.+]/m,alias:"keyword",inside:{regex:/\\\\[\[\]{},!?.*]/,operator:/[!?]|\.\.|\*{1,2}/,punctuation:/[\[\]{},]/}},property:/^[ \t]*[^\s=]+(?=[ \t]*=)/m,value:{pattern:/=.*/,alias:"string",inside:{punctuation:/^=/}}}; \ No newline at end of file +Prism.languages.editorconfig={comment:/[;#].*/,section:{pattern:/(^[ \t]*)\[.+]/m,lookbehind:!0,alias:"keyword",inside:{regex:/\\\\[\[\]{},!?.*]/,operator:/[!?]|\.\.|\*{1,2}/,punctuation:/[\[\]{},]/}},property:{pattern:/(^[ \t]*)[^\s=]+(?=[ \t]*=)/m,lookbehind:!0},value:{pattern:/=.*/,alias:"string",inside:{punctuation:/^=/}}}; \ No newline at end of file