feat: migrate to shiki, support custom code theme (#1692)

* refactor: migrate to shiki

* read code theme from character metadata

* update

* remove refractor

* save code theme

* update

* fix post editor

* update

* update

* update
This commit is contained in:
Stephen Zhou
2024-04-11 10:41:59 +08:00
committed by GitHub
parent 5c9214634d
commit ce6e64ff3c
22 changed files with 244 additions and 160 deletions
+10
View File
@@ -22,3 +22,13 @@ pre {
pre.mermaid {
@apply bg-transparent flex justify-center;
}
html.dark .shiki,
html.dark .shiki span {
color: var(--shiki-dark) !important;
background-color: var(--shiki-dark-bg) !important;
/* Optional, if you also want font styles */
font-style: var(--shiki-dark-font-style) !important;
font-weight: var(--shiki-dark-font-weight) !important;
text-decoration: var(--shiki-dark-text-decoration) !important;
}
-1
View File
@@ -4,5 +4,4 @@
@import "./tailwind.css";
@import "./prose.css";
@import "./code.css";
@import "./prism-dark.css";
@import "./print.css";
-81
View File
@@ -1,81 +0,0 @@
/** based on prism tomorrow */
pre,
code {
--code-bg: theme("colors.slate.50");
--code-fg: theme("colors.slate.600");
}
.token.comment,
.token.block-comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: #999;
}
.token.punctuation {
color: #ccc;
}
.token.tag,
.token.attr-name,
.token.namespace,
.token.deleted {
color: #e2777a;
}
.token.function-name {
color: #6196cc;
}
.token.boolean,
.token.number,
.token.function {
color: #f08d49;
}
.token.property,
.token.class-name,
.token.constant,
.token.symbol {
color: #f8c555;
}
.token.selector,
.token.important,
.token.atrule,
.token.keyword,
.token.builtin {
color: #cc99cd;
}
.token.string,
.token.char,
.token.attr-value,
.token.regex,
.token.variable {
color: #7ec699;
}
.token.operator,
.token.entity,
.token.url {
color: #67cdcc;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
.token.inserted {
color: green;
}