mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-06 07:56:11 +02:00
added dotenv highlight support for prismjs
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import Prism from "prismjs"
|
||||
|
||||
if (supportsLookBehind()) {
|
||||
Prism.languages.env = {
|
||||
property: {
|
||||
pattern: /(.*.)(?==)/,
|
||||
},
|
||||
string: {
|
||||
pattern: /(?<==)(.*.)/g,
|
||||
global: true,
|
||||
},
|
||||
operator: {
|
||||
pattern: /=/
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Prism.languages.env = {
|
||||
property: {
|
||||
pattern: /(.*.)(?==)/,
|
||||
},
|
||||
operator: {
|
||||
pattern: /=/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function supportsLookBehind() {
|
||||
try {
|
||||
return /(?<==)(.*)/.test("=hello")
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user