prism-code-editor
Version:
Lightweight, extensible code editor component for the web using Prism
64 lines (63 loc) • 1.65 kB
JavaScript
import { l as languages } from "../../index-DF54SWhA.js";
import { e as extend, i as insertBefore } from "../../language-BqHrf6z-.js";
import "./css.js";
var variable = /\$[-\w]+|#\{\$[-\w]+\}/;
var operator = {
pattern: /[%/*+]|[!=]=|<=?|>=?|\b(?:and|not|or)\b|(\s)-(?!\S)/,
lookbehind: true
};
var sass = languages.sass = extend("css", {
// Sass comments don't need to be closed, only indented
"comment": {
pattern: /^([ ]*)\/[/*].*(?:$\s*?\n\1[ ]+\S.*)*/mg,
lookbehind: true
}
});
insertBefore(sass, "atrule", {
// We want to consume the whole line
"atrule-line": {
// Includes support for = and + shortcuts
pattern: /^(?:[ ]*)[@+=].+/mg,
inside: {
"atrule": /(?:@[\w-]+|[+=])/
}
}
});
delete sass.atrule;
insertBefore(sass, "property", {
// We want to consume the whole line
"variable-line": {
pattern: /^[ ]*\$.+/mg,
inside: {
"punctuation": /:/,
"variable": variable,
"operator": operator
}
},
// We want to consume the whole line
"property-line": {
pattern: /^[ ]*(?:[^:\s]+ *:.*|:[^:\s].*)/mg,
inside: {
"property": [
/[^:\s]+(?=\s*:)/,
{
pattern: /(:)[^:\s]+/,
lookbehind: true
}
],
"punctuation": /:/,
"variable": variable,
"operator": operator,
"important": sass.important
}
}
});
delete sass.property;
delete sass.important;
insertBefore(sass, "punctuation", {
"selector": {
pattern: /^([ ]*)\S(?:,[^\n,]+|[^\n,]*)(?:,[^\n,]+)*(?:,\n\1[ ]+\S(?:,[^\n,]+|[^\n,]*)(?:,[^\n,]+)*)*/mg,
lookbehind: true
}
});
//# sourceMappingURL=sass.js.map