-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Restore URL, salt hashes * Guard against unknown languages; fix nested pre styles * Use val.town URL instead of my custom redirect * Rename salt to syntax_version * Add syntax version as env var
- Loading branch information
Showing
7 changed files
with
136 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { bundledLanguagesInfo } from "shiki/langs"; | ||
import { bundledThemesInfo } from "shiki/themes"; | ||
|
||
interface Theme { | ||
id: string; | ||
} | ||
type ThemeMap = Record<string, Theme>; | ||
|
||
const themes: ThemeMap = bundledThemesInfo.reduce( | ||
(themes: ThemeMap, theme: Theme) => { | ||
themes[theme.id] = theme; | ||
return themes; | ||
}, | ||
{} | ||
); | ||
|
||
interface Lang { | ||
id: string; | ||
aliases?: string[]; | ||
} | ||
type LangMap = Record<string, Lang>; | ||
|
||
const langs: LangMap = bundledLanguagesInfo.reduce( | ||
(langs: LangMap, lang: Lang) => { | ||
langs[lang.id] = lang; | ||
for (const alias of lang.aliases ?? []) { | ||
langs[alias] = lang; | ||
} | ||
return langs; | ||
}, | ||
{} | ||
); | ||
|
||
export const isThemeSupported = (theme: string) => { | ||
return !!themes[theme]; | ||
}; | ||
|
||
export const isLangSupported = (lang: string) => { | ||
return !!langs[lang]; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
// Generated by Wrangler by running `wrangler types` | ||
|
||
interface Env { | ||
KV_MAPPINGS: KVNamespace; | ||
KV_HIGHLIGHT: KVNamespace; | ||
NODE_VERSION: "v20.16.0"; | ||
PNPM_VERSION: "v9.7.0"; | ||
SITE: string; | ||
PUBLISH_KEY: string; | ||
SENTRY_DSN: string; | ||
SENTRY_AUTH_TOKEN: string; | ||
R2_BUCKET: R2Bucket; | ||
R2_ASSETS: R2Bucket; | ||
KV_MAPPINGS: KVNamespace; | ||
KV_HIGHLIGHT: KVNamespace; | ||
NODE_VERSION: "v20.16.0"; | ||
PNPM_VERSION: "v9.7.0"; | ||
SITE: string; | ||
PUBLISH_KEY: string; | ||
SENTRY_DSN: string; | ||
SENTRY_AUTH_TOKEN: string; | ||
SYNTAX_VERSION: string; | ||
R2_BUCKET: R2Bucket; | ||
R2_ASSETS: R2Bucket; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters