diff --git a/components/prism-css.js b/components/prism-css.js index ca86ba6f9f..9bc63fa637 100644 --- a/components/prism-css.js +++ b/components/prism-css.js @@ -7,9 +7,9 @@ Prism.languages.css = { // See rest below } }, - 'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i, + 'url': /url\((?:(["'])(\\[\w\W]|(?!\1)[^\\\r\n])*\1|.*?)\)/i, 'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/, - 'string': /("|')(\\\n|\\?.)*?\1/, + 'string': /("|')(\\[\w\W]|(?!\1)[^\\\r\n])*\1/, 'property': /(\b|\B)[\w-]+(?=\s*:)/i, 'important': /\B!important\b/i, 'function': /[-a-z0-9]+(?=\()/i, diff --git a/components/prism-css.min.js b/components/prism-css.min.js index f3d20421d2..0fdb8d51da 100644 --- a/components/prism-css.min.js +++ b/components/prism-css.min.js @@ -1 +1 @@ -Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/,string:/("|')(\\\n|\\?.)*?\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file +Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\[\w\W]|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/,string:/("|')(\\[\w\W]|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/[\w\W]*?<\/style>/i,inside:{tag:{pattern:/|<\/style>/i,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css},alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag)); \ No newline at end of file diff --git a/prism.js b/prism.js index 59c1e13bc2..49e0a9090c 100644 --- a/prism.js +++ b/prism.js @@ -491,9 +491,9 @@ Prism.languages.css = { // See rest below } }, - 'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/i, + 'url': /url\((?:(["'])(\\[\w\W]|(?!\1)[^\\\r\n])*\1|.*?)\)/i, 'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/, - 'string': /("|')(\\\n|\\?.)*?\1/, + 'string': /("|')(\\[\w\W]|(?!\1)[^\\\r\n])*\1/, 'property': /(\b|\B)[\w-]+(?=\s*:)/i, 'important': /\B!important\b/i, 'function': /[-a-z0-9]+(?=\()/i,