@elixpo/lixeditor 2.1.6

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 ADDED
@@ -0,0 +1,139 @@
1
+ # @elixpo/lixeditor
2
+
3
+ A rich WYSIWYG block editor and renderer built on [BlockNote](https://blocknotejs.org) — with LaTeX equations, Mermaid diagrams, syntax-highlighted code blocks, and more.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @elixpo/lixeditor @blocknote/core @blocknote/react @blocknote/mantine
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```jsx
14
+ import { LixEditor, LixPreview, LixThemeProvider } from '@elixpo/lixeditor';
15
+ import '@blocknote/core/fonts/inter.css';
16
+ import '@blocknote/mantine/style.css';
17
+ import '@elixpo/lixeditor/styles';
18
+
19
+ function App() {
20
+ const [blocks, setBlocks] = useState(null);
21
+
22
+ return (
23
+ <LixThemeProvider defaultTheme="dark">
24
+ {/* Editor */}
25
+ <LixEditor
26
+ initialContent={blocks}
27
+ onChange={(editor) => setBlocks(editor.getBlocks())}
28
+ features={{
29
+ equations: true,
30
+ mermaid: true,
31
+ codeHighlighting: true,
32
+ tableOfContents: true,
33
+ linkPreview: true,
34
+ }}
35
+ placeholder="Start writing..."
36
+ />
37
+
38
+ {/* Preview / Reader */}
39
+ <LixPreview blocks={blocks} />
40
+ </LixThemeProvider>
41
+ );
42
+ }
43
+ ```
44
+
45
+ ## Features
46
+
47
+ | Feature | Default | Description |
48
+ |---------|---------|-------------|
49
+ | `equations` | `true` | Block & inline LaTeX via KaTeX |
50
+ | `mermaid` | `true` | Mermaid diagram blocks (flowchart, sequence, etc.) |
51
+ | `codeHighlighting` | `true` | Shiki syntax highlighting with 30+ languages |
52
+ | `tableOfContents` | `true` | Auto-generated TOC block |
53
+ | `images` | `true` | Image blocks with upload, embed, captions |
54
+ | `buttons` | `true` | Interactive button blocks |
55
+ | `pdf` | `true` | PDF embed blocks |
56
+ | `dates` | `true` | Inline date picker chips |
57
+ | `linkPreview` | `true` | OG metadata tooltip on link hover |
58
+ | `markdownLinks` | `true` | Auto-convert `[text](url)` to links |
59
+
60
+ ## Extending
61
+
62
+ ### Custom Block Specs
63
+
64
+ ```jsx
65
+ <LixEditor
66
+ extraBlockSpecs={[
67
+ { type: 'myBlock', spec: MyCustomBlockSpec({}) }
68
+ ]}
69
+ extraInlineSpecs={[
70
+ { type: 'myInline', spec: MyInlineSpec }
71
+ ]}
72
+ slashMenuItems={[
73
+ { title: 'My Block', group: 'Custom', onItemClick: (editor) => { ... } }
74
+ ]}
75
+ />
76
+ ```
77
+
78
+ ### Theming
79
+
80
+ Override CSS variables to customize colors:
81
+
82
+ ```css
83
+ :root {
84
+ --lix-accent: #e040fb;
85
+ --lix-bg-app: #fafafa;
86
+ --lix-font-body: 'Inter', sans-serif;
87
+ }
88
+ ```
89
+
90
+ ### Using Individual Blocks
91
+
92
+ ```jsx
93
+ import { BlockEquation, MermaidBlock, InlineEquation } from '@elixpo/lixeditor';
94
+ import { BlockNoteSchema, defaultBlockSpecs } from '@blocknote/core';
95
+
96
+ const schema = BlockNoteSchema.create({
97
+ blockSpecs: {
98
+ ...defaultBlockSpecs,
99
+ blockEquation: BlockEquation({}),
100
+ mermaidBlock: MermaidBlock({}),
101
+ },
102
+ });
103
+ ```
104
+
105
+ ## API Reference
106
+
107
+ ### `<LixEditor />`
108
+
109
+ | Prop | Type | Description |
110
+ |------|------|-------------|
111
+ | `initialContent` | `Block[]` | Initial BlockNote document |
112
+ | `onChange` | `(editor) => void` | Called on content change |
113
+ | `features` | `object` | Enable/disable features |
114
+ | `codeLanguages` | `object` | Custom language map for code blocks |
115
+ | `extraBlockSpecs` | `array` | Additional block specs |
116
+ | `extraInlineSpecs` | `array` | Additional inline content specs |
117
+ | `slashMenuItems` | `array` | Extra slash menu items |
118
+ | `placeholder` | `string` | Editor placeholder text |
119
+ | `collaboration` | `object` | Yjs collaboration config |
120
+ | `ref` | `ref` | Access editor methods: `getBlocks()`, `getHTML()`, `getMarkdown()` |
121
+
122
+ ### `<LixPreview />`
123
+
124
+ | Prop | Type | Description |
125
+ |------|------|-------------|
126
+ | `blocks` | `Block[]` | BlockNote document to render |
127
+ | `html` | `string` | Fallback raw HTML |
128
+ | `features` | `object` | Enable/disable post-processing features |
129
+
130
+ ### `<LixThemeProvider />`
131
+
132
+ | Prop | Type | Description |
133
+ |------|------|-------------|
134
+ | `defaultTheme` | `'light' \| 'dark'` | Initial theme |
135
+ | `storageKey` | `string` | localStorage key for persistence |
136
+
137
+ ## License
138
+
139
+ MIT