You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Added new text cursor fields & functions docs
* Made website and JS docs have same information + minor changes/fixes
* More minor changes & fixes
* More minor changes & fixes
* Added block structure diagram
* remove margin from editor (this is now built-in)
* Added PR feedback and cleaned up links
---------
Co-authored-by: yousefed <[email protected]>
Copy file name to clipboardExpand all lines: packages/website/docs/docs/blocks.md
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,11 @@ function App() {
29
29
30
30
## Block Objects
31
31
32
-
So, BlockNote is centered around the idea of blocks. A block - like a Heading, Paragraph, or List item - contains a piece of content and optionally nested blocks. In code, the `Block` type is used to describe any given block in the editor:
32
+
So, BlockNote is centered around the idea of blocks. A block - like a heading, paragraph, or list item - contains a piece of content and optionally nested blocks:
In code, the `Block` type is used to describe any given block in the editor:
33
37
34
38
```typescript
35
39
typeBlock= {
@@ -43,11 +47,11 @@ type Block = {
43
47
44
48
`id:` The block's ID. Multiple blocks cannot share a single ID, and a block will keep the same ID from when it's created until it's removed.
45
49
46
-
`type:` The block's type, such as a paragraph, heading, or list item. For an overview of built-in block types, see [Block Types & Properties](block-types).
50
+
`type:` The block's type, such as a paragraph, heading, or list item. For an overview of built-in block types, see [Built-In Block Types](/docs/block-types#built-in-block-types).
47
51
48
-
`props:` The block's propertiesare stored in a set of key/value pairs and specify how the block looks and behaves. Different block types have different props - see [Block Types](block-types) for more.
52
+
`props:` The block's properties, which are stored in a set of key/value pairs and specify how the block looks and behaves. Different block types have different props - see [Block Types & Properties](/docs/block-types) for more.
49
53
50
-
`content:` The block's content, represented as an array of `InlineNode` objects. This does not include content from any nested blocks. For more information on `InlineNode` objects, visit [Inline Content](inline-content.md).
54
+
`content:` The block's content, represented as an array of `InlineContent` objects. This does not include content from any nested blocks. For more information on `InlineContent` objects, visit [Inline Content](/docs/inline-content).
51
55
52
56
`children:` Any blocks nested inside the block. The nested blocks are also represented using `Block` objects.
53
57
@@ -85,11 +89,4 @@ export default function App() {
Copy file name to clipboardExpand all lines: packages/website/docs/docs/converting-blocks.md
+13-6Lines changed: 13 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ It's possible to export Blocks to other formats, or import Blocks from other for
5
5
::: warning
6
6
The functions to import / export to and from HTML / Markdown are considered "lossy"; some information might be dropped when you export Blocks to those formats.
7
7
8
-
To serialize Blocks to a non-lossy format (for example, to store the contents of the editor in your backend), simply export the builtin Block format using `JSON.stringify(editor.allBlocks)`.
8
+
To serialize Blocks to a non-lossy format (for example, to store the contents of the editor in your backend), simply export the built-in Block format using `JSON.stringify(editor.allBlocks)`.
`returns:` The blocks, serialized as an HTML string.
32
+
33
+
To better conform to HTML standards, children of blocks which aren't list items are un-nested in the output HTML.
34
+
31
35
**Example**
32
36
33
37
TODO
@@ -48,7 +52,9 @@ class BlockNoteEditor {
48
52
const blocksFromHTML =editor.HTMLToBlocks(html);
49
53
```
50
54
51
-
This function will try to create `Block` objects out of any HTML block-level elements, and`InlineNode` objects from any HTML inline elements, though not all types of elements are recognized. If BlockNote doesn't recognize an HTML element's tag, it will parse it as a paragraph or plain text.
55
+
`returns:` The blocks parsed from the HTML string.
56
+
57
+
Tries to create `Block` objects out of any HTML block-level elements, and `InlineNode` objects from any HTML inline elements, though not all HTML tags are recognized. If BlockNote doesn't recognize an element's tag, it will parse it as a paragraph or plain text.
Some features of blocks can't be represented using Markdown, such as block color or text alignment, so some information is lost from the conversion:
83
+
`returns:` The blocks, serialized as a Markdown string.
78
84
79
-
1. All blocks, except ones inside list items, are no longer nested since Markdown doesn't support nesting for them.
80
-
2. Underline, text color, and background color styles are removed as Markdown doesn't support them.
85
+
The output is simplified as Markdown does not support all features of BlockNote - children of blocks which aren't list items are un-nested and certain styles are removed.
This function will try to create `Block` objects and `InlineNode` objects based on the Markdown syntax, though not all symbols are recognized. If BlockNote doesn't recognize a symbol, it will parse it as text.
107
+
`returns:` The blocks parsed from the Markdown string.
108
+
109
+
Tries to create `Block` and `InlineNode` objects based on Markdown syntax, though not all symbols are recognized. If BlockNote doesn't recognize a symbol, it will parse it as text.
0 commit comments