mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-25 00:14:07 +01:00
Refactor code language and ts types (#9300)
* 🎨 Code block language list adds custom languages * Update index.d.ts * 🎨 Improve global variable type definition * 🎨 Improve global variable type definition * 🎨 Add constant `EXTRA_CODE_LANGUAGES`
This commit is contained in:
parent
17d2a16a94
commit
b2a27bb54c
16 changed files with 86 additions and 72 deletions
9
app/src/types/index.d.ts
vendored
9
app/src/types/index.d.ts
vendored
|
|
@ -81,6 +81,15 @@ type TAVFilterOperator =
|
|||
declare module "blueimp-md5"
|
||||
|
||||
interface Window {
|
||||
ABCJS?: IABCJS
|
||||
Viewer?: Function
|
||||
Viz?: IViz
|
||||
echarts?: IECharts
|
||||
hljs?: IHLJS
|
||||
katex?: IKaTeX
|
||||
mermaid?: IMermaid
|
||||
plantumlEncoder?: IPlantumlEncoder
|
||||
|
||||
pdfjsLib: any
|
||||
dataLayer: any[]
|
||||
siyuan: ISiyuan
|
||||
|
|
|
|||
49
app/src/types/protyle.d.ts
vendored
49
app/src/types/protyle.d.ts
vendored
|
|
@ -1,15 +1,13 @@
|
|||
declare const echarts: {
|
||||
init(element: HTMLElement, theme?: string, options?: { width: number }): IEChart;
|
||||
dispose(element: Element): void;
|
||||
getInstanceById(id: string): { resize: () => void };
|
||||
};
|
||||
interface IABCJS {
|
||||
renderAbc(element: Element, text: string, options: { responsive: string }): void;
|
||||
}
|
||||
|
||||
declare const hljs: {
|
||||
highlight(text: string, options: { language?: string, ignoreIllegals: boolean }): { value: string };
|
||||
getLanguage(text: string): { name: string };
|
||||
};
|
||||
interface IViz {
|
||||
new(worker: { worker: Worker }): IViz;
|
||||
renderSVGElement: (code: string) => Promise<any>;
|
||||
}
|
||||
|
||||
interface IEChart {
|
||||
interface IEChartsInstance {
|
||||
setOption(option: any): void;
|
||||
|
||||
getZr(): any;
|
||||
|
|
@ -21,6 +19,37 @@ interface IEChart {
|
|||
resize(): void;
|
||||
}
|
||||
|
||||
interface IECharts {
|
||||
init(element: HTMLElement, theme?: string, options?: { width: number }): IEChartsInstance;
|
||||
dispose(element: Element): void;
|
||||
getInstanceById(id: string): { resize: () => void };
|
||||
}
|
||||
|
||||
interface IHLJS {
|
||||
highlight(text: string, options: { language?: string, ignoreIllegals: boolean }): { value: string };
|
||||
getLanguage(text: string): { name: string };
|
||||
listLanguages(): string[];
|
||||
}
|
||||
|
||||
interface IKaTeX {
|
||||
renderToString(math: string, option: {
|
||||
displayMode: boolean;
|
||||
output: string;
|
||||
macros: IObject;
|
||||
trust: boolean;
|
||||
strict: (errorCode: string) => "ignore" | "warn";
|
||||
}): string;
|
||||
}
|
||||
|
||||
interface IMermaid {
|
||||
initialize(options: any): void;
|
||||
init(options: any, element: Element): void;
|
||||
}
|
||||
|
||||
interface IPlantumlEncoder {
|
||||
encode(options: string): string;
|
||||
}
|
||||
|
||||
interface ILuteNode {
|
||||
TokensStr: () => string;
|
||||
__internal_object__: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue