mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +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;
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import "prismjs/plugins/line-numbers/prism-line-numbers.css"
|
||||
import React, { FC, useEffect } from "react"
|
||||
import { MDXRenderer } from "gatsby-plugin-mdx"
|
||||
import * as SC from "./styles"
|
||||
import "./env";
|
||||
|
||||
interface IMarkdownProps {
|
||||
content: string
|
||||
|
||||
Reference in New Issue
Block a user