Skip to content

Commit af2f611

Browse files
authored
Merge pull request #316 from Nova38/Nova38/issue255
Enable Talon syntax highlighting via shiki
2 parents 156c8ee + 3c1cb12 commit af2f611

File tree

6 files changed

+5057
-2211
lines changed

6 files changed

+5057
-2211
lines changed

docusaurus.config.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
import { themes as prismThemes } from "prism-react-renderer";
21
import type { Config } from "@docusaurus/types";
32
import type * as Preset from "@docusaurus/preset-classic";
3+
import rehypeShiki, { RehypeShikiOptions } from "@shikijs/rehype";
4+
import { BundledLanguage, bundledLanguages, ShikiTransformer } from "shiki";
5+
// import talonLanguage from "./talon.tmLanguage.json" ;
6+
import { transformerColorizedBrackets } from "@shikijs/colorized-brackets";
7+
import { transformerNotationHighlight } from "@shikijs/transformers";
48

59
const config: Config = {
610
title: "Talon Community Wiki",
@@ -39,6 +43,23 @@ const config: Config = {
3943
sidebarPath: "./sidebars.ts",
4044
// Remove this to remove the "edit this page" links.
4145
editUrl: "https://github.com/TalonCommunity/Wiki/edit/main/",
46+
beforeDefaultRehypePlugins: [
47+
[
48+
// customRehypeShiki,
49+
rehypeShiki,
50+
{
51+
themes: {
52+
light: "catppuccin-latte",
53+
dark: "catppuccin-macchiato",
54+
},
55+
inline: "tailing-curly-colon",
56+
transformers: [
57+
// transformerColorizedBrackets() as unknown as ShikiTransformer,
58+
],
59+
langs: Object.keys(bundledLanguages) as BundledLanguage[],
60+
} satisfies RehypeShikiOptions,
61+
],
62+
],
4263
},
4364
theme: {
4465
customCss: "./src/css/custom.css",
@@ -171,11 +192,6 @@ const config: Config = {
171192
],
172193
copyright: `Copyright © ${new Date().getFullYear()} Talon Community`,
173194
},
174-
prism: {
175-
theme: prismThemes.github,
176-
darkTheme: prismThemes.dracula,
177-
additionalLanguages: ["talon"],
178-
},
179195
colorMode: {
180196
respectPrefersColorScheme: true,
181197
},

0 commit comments

Comments
 (0)