refactor: identifier escapes + "self" group (#339)

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
Justice Almanzar 2022-12-19 17:59:54 -05:00 committed by GitHub
parent 4974c53f9c
commit 989bd36eeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 157 additions and 30 deletions

View file

@ -22,7 +22,7 @@ import { wordsFromPascal, wordsToTitle } from "@utils/text";
import definePlugin, { OptionType } from "@utils/types";
import previewExampleText from "~fileContent/previewExample.tsx";
import cssText from "~fileContent/style.css";
import cssText from "~fileContent/shiki.css";
import { Settings } from "../../Vencord";
import { shiki } from "./api/shiki";
@ -44,8 +44,8 @@ export default definePlugin({
{
find: "codeBlock:{react:function",
replacement: {
match: /codeBlock:\{react:function\((.),(.),(.)\)\{/,
replace: "$&return Vencord.Plugins.plugins.ShikiCodeblocks.renderHighlighter($1,$2,$3);",
match: /codeBlock:\{react:function\((\i),(\i),(\i)\)\{/,
replace: "$&return $self.renderHighlighter($1,$2,$3);",
},
},
],

View file

@ -1,10 +1,13 @@
.shiki-root {
border-radius: 4px;
.shiki-container {
border: 4px;
/* fallback background */
background-color: var(--background-secondary);
}
.shiki-root {
border-radius: 4px;
}
.shiki-root code {
display: block;
overflow-x: auto;