Skip to content

Commit 3e894b4

Browse files
committed
Updated docs
1 parent f645911 commit 3e894b4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

docs/content/docs/features/extensions.mdx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ BlockNote includes an extensions system which lets you expand the editor's behav
1414

1515
## Creating an extension
1616

17-
An extension is an instance of the [`BlockNoteExtension`](https://github.com/TypeCellOS/BlockNote/blob/10cdbfb5f77ef82f3617c0fa1191e0bf5b7358c5/packages/core/src/editor/BlockNoteExtension.ts#L13) class. However, it's recommended for most use cases to create extensions using the `createExtension` function, rather than instanciating the class directly:
17+
You can create extensions using the `createExtension` function:
1818

1919
```typescript
20-
type BlockNoteExtensionOptions = {
20+
type Extension = {
2121
key: string;
2222
keyboardShortcuts?: Record<
2323
string,
@@ -35,15 +35,13 @@ type BlockNoteExtensionOptions = {
3535
tiptapExtensions?: AnyExtension[];
3636
}
3737

38-
const customBlockExtensionOptions: BlockNoteExtensionOptions = {
38+
const CustomExtension = createExtension({
3939
key: "customBlockExtension",
4040
keyboardShortcuts: ...,
4141
inputRules: ...,
4242
plugins: ...,
4343
tiptapExtensions: ...,
44-
}
45-
46-
const CustomExtension = createExtension(customBlockExtensionOptions);
44+
});
4745
```
4846

4947
Let's go over the options that can be passed into `createExtension`:
@@ -68,7 +66,7 @@ Extensions can be added to the editor on their own via the [editor options](/doc
6866

6967
### Adding directly to the editor
7068

71-
The `extensions` [editor option](/docs/reference/editor/overview#options) takes an array of `BlockNoteExtension`s to be added to the editor:
69+
The `extensions` [editor option](/docs/reference/editor/overview#options) takes an array of extensions to be added to the editor:
7270

7371
```typescript
7472
const editor = useCreateBlockNote({
@@ -81,7 +79,7 @@ const editor = useCreateBlockNote({
8179

8280
### Adding to custom blocks
8381

84-
When creating a [custom block](/docs/features/custom-schemas/custom-blocks#creating-a-custom-block-type) using `createReactBlockSpec`, you can pass an array of `BlockNoteExtension`s to the third parameter:
82+
When creating a [custom block](/docs/features/custom-schemas/custom-blocks#creating-a-custom-block-type) using `createReactBlockSpec`, you can pass an array of extensions to the third parameter:
8583

8684
```typescript
8785
const createCustomBlock = createReactBlockSpec(

0 commit comments

Comments
 (0)