export support prismjs language
This commit is contained in:
@@ -5,5 +5,7 @@ export * from "./tiptap/shared";
|
||||
export * from "./tiptap/extensions";
|
||||
export * from "./tiptap/useTiptapEditor";
|
||||
export * from "./tiptap/useTiptapView";
|
||||
export { supportedCodeLanguages } from "../utils/Prism";
|
||||
export type { CodeLanguageOption } from "../utils/Prism";
|
||||
export { default as PrismCodeBlock } from "./tiptap/PrismCodeBlock";
|
||||
export { enhancePrismCodeBlock } from "./tiptap/PrismCodeBlockView";
|
||||
|
||||
@@ -18,6 +18,34 @@ import "prismjs/components/prism-sql";
|
||||
import "prismjs/components/prism-typescript";
|
||||
import "prismjs/components/prism-yaml";
|
||||
|
||||
/** Prism 已加载并支持语法高亮的代码语言。 */
|
||||
export type CodeLanguageOption = {
|
||||
label: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
/** 编辑器可用的代码语言,按名称首字母排序。 */
|
||||
export const supportedCodeLanguages: CodeLanguageOption[] = [
|
||||
{ label: "Apache Config", value: "apacheconf" },
|
||||
{ label: "Bash", value: "bash" },
|
||||
{ label: "CSS", value: "css" },
|
||||
{ label: "HTML", value: "html" },
|
||||
{ label: "INI", value: "ini" },
|
||||
{ label: "Java", value: "java" },
|
||||
{ label: "JavaScript", value: "javascript" },
|
||||
{ label: "JSON", value: "json" },
|
||||
{ label: "Less", value: "less" },
|
||||
{ label: "Nginx", value: "nginx" },
|
||||
{ label: "PHP", value: "php" },
|
||||
{ label: "Properties", value: "properties" },
|
||||
{ label: "Shell", value: "sh" },
|
||||
{ label: "SQL", value: "sql" },
|
||||
{ label: "TypeScript", value: "typescript" },
|
||||
{ label: "Vue", value: "vue" },
|
||||
{ label: "XML", value: "xml" },
|
||||
{ label: "YAML", value: "yaml" }
|
||||
];
|
||||
|
||||
const prismLanguageAliasMap: Record<string, string> = {
|
||||
html: "markup",
|
||||
xml: "markup",
|
||||
|
||||
Reference in New Issue
Block a user