tiptap-extension-code-block-shiki 0.7.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,7 +42,7 @@ new Editor({
42
42
  extensions: [
43
43
  StarterKit.configure({ codeBlock: false }),
44
44
  CodeBlockShiki.configure({
45
- defaultTheme: 'tokyo-night' // Fallback theme
45
+ defaultTheme: 'tokyo-night', // Fallback theme
46
46
  themes: {
47
47
  light: 'github-light',
48
48
  dark: 'github-dark',
@@ -82,6 +82,26 @@ html.dark .tiptap .shiki span {
82
82
  }
83
83
  ```
84
84
 
85
+ ### Custom Theme Support
86
+
87
+ You can optionally supply your own custom themes
88
+
89
+ ```ts
90
+ import type { ThemeRegistration } from 'shiki'
91
+
92
+ const myTheme: ThemeRegistration = {
93
+ name: 'my-theme',
94
+ type: 'dark',
95
+ colors: { 'editor.background': '#1e1e2e' },
96
+ tokenColors: [/* ... */]
97
+ }
98
+
99
+ CodeBlockShiki.configure({
100
+ defaultTheme: 'my-theme',
101
+ customThemes: [myTheme],
102
+ })
103
+ ```
104
+
85
105
  ## Demo
86
106
 
87
107
  I posted a small screen recording here: https://mastodon.social/@timomeh/112282962825285237
@@ -94,7 +114,7 @@ The extension extends [CodeBlock](https://tiptap.dev/docs/editor/api/nodes/code-
94
114
 
95
115
  Which theme to use by default. See https://shiki.style/themes.
96
116
 
97
- ## `themes`
117
+ ### `themes`
98
118
 
99
119
  Optionally specify themes for light and dark mode. See https://shiki.matsu.io/guide/dual-themes
100
120
 
@@ -102,6 +122,10 @@ Optionally specify themes for light and dark mode. See https://shiki.matsu.io/gu
102
122
 
103
123
  Which language to use, when no language was provided. See https://shiki.style/languages.
104
124
 
125
+ ### `customThemes`
126
+
127
+ Register custom themes. See https://shiki.style/guide/load-theme#load-custom-themes.
128
+
105
129
  ## Notes
106
130
 
107
131
  ### Lazy loading
@@ -2,6 +2,7 @@ import { BundledLanguage } from 'shiki';
2
2
  import { BundledTheme } from 'shiki';
3
3
  import { CodeBlockOptions } from '@tiptap/extension-code-block';
4
4
  import { Node as Node_2 } from '@tiptap/core';
5
+ import { ThemeRegistration } from 'shiki';
5
6
 
6
7
  declare const CodeBlockShiki: Node_2<CodeBlockShikiOptions, any>;
7
8
  export { CodeBlockShiki }
@@ -9,11 +10,12 @@ export default CodeBlockShiki;
9
10
 
10
11
  export declare interface CodeBlockShikiOptions extends CodeBlockOptions {
11
12
  defaultLanguage: BundledLanguage | null | undefined;
12
- defaultTheme: BundledTheme;
13
+ defaultTheme: BundledTheme | (string & {});
13
14
  themes: {
14
15
  light: BundledTheme;
15
16
  dark: BundledTheme;
16
17
  } | null | undefined;
18
+ customThemes: ThemeRegistration[] | null | undefined;
17
19
  }
18
20
 
19
21
  export { }