53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
|
Prism.languages.css = {
|
||
|
'comment': /\/\*[\s\S]*?\*\//,
|
||
|
'atrule': {
|
||
|
pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
|
||
|
inside: {
|
||
|
'rule': /@[\w-]+/
|
||
|
// See rest below
|
||
|
}
|
||
|
},
|
||
|
'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
|
||
|
'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
|
||
|
'string': {
|
||
|
pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
||
|
greedy: true
|
||
|
},
|
||
|
'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
|
||
|
'important': /!important\b/i,
|
||
|
'function': /[-a-z0-9]+(?=\()/i,
|
||
|
'punctuation': /[(){};:,]/
|
||
|
};
|
||
|
|
||
|
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
||
|
|
||
|
if (Prism.languages.markup) {
|
||
|
Prism.languages.insertBefore('markup', 'tag', {
|
||
|
'style': {
|
||
|
pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
|
||
|
lookbehind: true,
|
||
|
inside: Prism.languages.css,
|
||
|
alias: 'language-css',
|
||
|
greedy: true
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Prism.languages.insertBefore('inside', 'attr-value', {
|
||
|
'style-attr': {
|
||
|
pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\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);
|
||
|
}
|