PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.1
Code Block Pro – Beautiful Syntax Highlighting v1.27.1
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / src / types.ts

types.ts in Code Block Pro – Beautiful Syntax Highlighting 1.27.1, at src/types.ts

100 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Lang as LangShiki, Theme } from 'shiki';
2
3 export type Lang = LangShiki | 'ansi' | 'plaintext';
4
5 export type Attributes = {
6 code: string;
7 codeHTML: string;
8 language: Lang;
9 theme: Theme;
10 align: 'wide' | 'full';
11 bgColor: string;
12 textColor: string;
13 fontSize: string;
14 fontFamily: string;
15 lineHeight: string;
16 lineNumbers: boolean;
17 clampFonts: boolean;
18 editorHeight: string;
19 headerType: string;
20 headerString?: string;
21 footerType?: string;
22 footerString?: string;
23 footerLink?: string;
24 enableMaxHeight?: boolean;
25 seeMoreType?: string;
26 seeMoreString?: string;
27 seeMoreAfterLine?: string;
28 seeMoreTransition?: boolean;
29 seeMoreCollapse?: boolean;
30 seeMoreCollapseString?: string;
31 footerLinkTarget?: boolean;
32 disablePadding: boolean;
33 startingLineNumber: string;
34 // Defunct - Removing it would require n attribute migration
35 // so it's easier to just leave it unused for new blocks.
36 lineNumbersWidth: number;
37 highestLineNumber: number;
38 enableHighlighting: boolean;
39 highlightingHover: boolean;
40 lineHighlights: string;
41 lineHighlightColor: string;
42 enableBlurring: boolean;
43 lineBlurs: string;
44 removeBlurOnHover: boolean;
45 frame: boolean;
46 renderType: string;
47 label: string;
48 copyButton: boolean;
49 copyButtonType: string;
50 copyButtonString: string;
51 copyButtonStringCopied: string;
52 useDecodeURI: boolean;
53 useEscapeShortCodes: boolean;
54 tabSize: number;
55 useTabs: boolean;
56 };
57 export interface AttributesPropsAndSetter {
58 attributes: Attributes;
59 setAttributes: (attrs: Partial<Attributes>) => void;
60 }
61
62 declare global {
63 interface Window {
64 codeBlockPro: {
65 pluginUrl: string;
66 };
67 }
68 }
69
70 export type CustomStyles = {
71 'color-text'?: string; // --shiki-color-text
72 'color-background'?: string; // --shiki-color-background
73 'token-constant'?: string; // --shiki-token-constant
74 'token-string'?: string; // --shiki-token-string
75 'token-comment'?: string; // --shiki-token-comment
76 'token-keyword'?: string; // --shiki-token-keyword
77 'token-parameter'?: string; // --shiki-token-parameter
78 'token-function'?: string; // --shiki-token-function
79 'token-string-expression'?: string; // --shiki-token-string-expression
80 'token-punctuation'?: string; // --shiki-token-punctuation
81 'token-link'?: string; // --shiki-token-link
82 'line-background'?: string; // custom for this app
83 'line-number-color'?: string; // custom for this app
84 };
85 export type HelpUrl = {
86 text: string;
87 url: string;
88 };
89
90 export type ThemeOption = Record<
91 string,
92 {
93 name: string;
94 priority?: boolean;
95 custom?: boolean;
96 styles?: CustomStyles;
97 helpUrl?: HelpUrl;
98 }
99 >;
100