PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.25.0
Code Block Pro – Beautiful Syntax Highlighting v1.25.0
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.25.0, at src/types.ts

95 lines 2.6 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 footerLinkTarget?: boolean;
30 disablePadding: boolean;
31 startingLineNumber: string;
32 // Defunct - Removing it would require n attribute migration
33 // so it's easier to just leave it unused for new blocks.
34 lineNumbersWidth: number;
35 highestLineNumber: number;
36 enableHighlighting: boolean;
37 highlightingHover: boolean;
38 lineHighlights: string;
39 lineHighlightColor: string;
40 enableBlurring: boolean;
41 lineBlurs: string;
42 removeBlurOnHover: boolean;
43 frame: boolean;
44 renderType: string;
45 label: string;
46 copyButton: boolean;
47 copyButtonType: string;
48 useDecodeURI: boolean;
49 tabSize: number;
50 useTabs: boolean;
51 };
52 export interface AttributesPropsAndSetter {
53 attributes: Attributes;
54 setAttributes: (attrs: Partial<Attributes>) => void;
55 }
56
57 declare global {
58 interface Window {
59 codeBlockPro: {
60 pluginUrl: string;
61 };
62 }
63 }
64
65 export type CustomStyles = {
66 'color-text'?: string; // --shiki-color-text
67 'color-background'?: string; // --shiki-color-background
68 'token-constant'?: string; // --shiki-token-constant
69 'token-string'?: string; // --shiki-token-string
70 'token-comment'?: string; // --shiki-token-comment
71 'token-keyword'?: string; // --shiki-token-keyword
72 'token-parameter'?: string; // --shiki-token-parameter
73 'token-function'?: string; // --shiki-token-function
74 'token-string-expression'?: string; // --shiki-token-string-expression
75 'token-punctuation'?: string; // --shiki-token-punctuation
76 'token-link'?: string; // --shiki-token-link
77 'line-background'?: string; // custom for this app
78 'line-number-color'?: string; // custom for this app
79 };
80 export type HelpUrl = {
81 text: string;
82 url: string;
83 };
84
85 export type ThemeOption = Record<
86 string,
87 {
88 name: string;
89 priority?: boolean;
90 custom?: boolean;
91 styles?: CustomStyles;
92 helpUrl?: HelpUrl;
93 }
94 >;
95