You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
10 years ago
|
Prism.languages.css = {
|
||
|
'comment': /\/\*[\w\W]*?\*\//g,
|
||
|
'atrule': {
|
||
|
pattern: /@[\w-]+?.*?(;|(?=\s*\{))/gi,
|
||
|
inside: {
|
||
|
'punctuation': /[;:]/g
|
||
|
}
|
||
|
},
|
||
|
'url': /url\((?:(["'])(\\\n|\\?.)*?\1|.*?)\)/gi,
|
||
|
'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/g,
|
||
|
'string': /("|')(\\\n|\\?.)*?\1/g,
|
||
|
'property': /(\b|\B)[\w-]+(?=\s*:)/ig,
|
||
|
'important': /\B!important\b/gi,
|
||
|
'punctuation': /[\{\};:]/g,
|
||
|
'function': /[-a-z0-9]+(?=\()/ig
|
||
|
};
|
||
|
|
||
|
if (Prism.languages.markup) {
|
||
|
Prism.languages.insertBefore('markup', 'tag', {
|
||
|
'style': {
|
||
|
pattern: /<style[\w\W]*?>[\w\W]*?<\/style>/ig,
|
||
|
inside: {
|
||
|
'tag': {
|
||
|
pattern: /<style[\w\W]*?>|<\/style>/ig,
|
||
|
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/ig,
|
||
|
inside: {
|
||
|
'attr-name': {
|
||
|
pattern: /^\s*style/ig,
|
||
|
inside: Prism.languages.markup.tag.inside
|
||
|
},
|
||
|
'punctuation': /^\s*=\s*['"]|['"]\s*$/,
|
||
|
'attr-value': {
|
||
|
pattern: /.+/gi,
|
||
|
inside: Prism.languages.css
|
||
|
}
|
||
|
},
|
||
|
alias: 'language-css'
|
||
|
}
|
||
|
}, Prism.languages.markup.tag);
|
||
|
}
|