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
It's possible to export Blocks to other formats, or import Blocks from other formats.
3
+
It's possible to export or import Blocks to and from Markdown and HTML.
4
4
5
5
::: warning
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.
6
+
The functions to import/export to and from Markdown/HTML are considered "lossy"; some information might be dropped when you export Blocks to those formats.
7
7
8
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)`.
9
9
:::
10
10
11
-
## HTML
11
+
## Markdown
12
12
13
-
We expose functions to convert Blocks to and from HTML. Converting Blocks to HTML will lose some information such as the nesting of nodes in order to export a simple HTML structure.
13
+
BlockNote can import / export Blocks to and from Markdown. Note that this is also considered "lossy", as not all structures can be entirely represented in Markdown.
14
14
15
-
### Converting Blocks to HTML
15
+
### Converting Blocks to Markdown
16
16
17
-
`Block` objects can be serialized to an HTML string using the following function:
17
+
`Block` objects can be serialized to a Markdown string using the following function:
`returns:` The blocks, serialized as an HTML string.
31
+
`returns:` The blocks, serialized as a Markdown string.
32
32
33
-
To better conform to HTML standards, children of blocks which aren't list items are un-nested in the output HTML.
33
+
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.
`returns:` The blocks parsed from the HTML string.
91
+
`returns:` The blocks parsed from the Markdown string.
93
92
94
-
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.
93
+
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.
95
94
96
95
**Demo**
97
96
@@ -112,29 +111,29 @@ export default function App() {
@@ -144,29 +143,29 @@ export default function App() {
144
143
145
144
:::
146
145
147
-
## Markdown
146
+
## HTML
148
147
149
-
BlockNote can import / export Blocks to and from Markdown. Note that this is also considered "lossy", as not all structures can be entirely represented in Markdown.
148
+
We expose functions to convert Blocks to and from HTML. Converting Blocks to HTML will lose some information such as the nesting of nodes in order to export a simple HTML structure.
150
149
151
-
### Converting Blocks to Markdown
150
+
### Converting Blocks to HTML
152
151
153
-
`Block` objects can be serialized to a Markdown string using the following function:
152
+
`Block` objects can be serialized to an HTML string using the following function:
`returns:` The blocks, serialized as a Markdown string.
166
+
`returns:` The blocks, serialized as an HTML string.
168
167
169
-
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.
168
+
To better conform to HTML standards, children of blocks which aren't list items are un-nested in the output HTML.
`returns:` The blocks parsed from the Markdown string.
226
+
`returns:` The blocks parsed from the HTML string.
228
227
229
-
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.
228
+
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.
230
229
231
230
**Demo**
232
231
@@ -247,34 +246,34 @@ export default function App() {
Copy file name to clipboardExpand all lines: packages/website/docs/docs/cursor-selections.md
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,14 @@
1
-
# Cursor and Selections
1
+
# Cursor & Selections
2
2
3
-
This page will explain how to work with the Cursor and Selections
4
-
5
-
- explain differences
6
-
- how to get / set them
7
-
- examples (how to get)
3
+
If you want to know which block(s) the user is currently editing, you can do so using cursor positions and selections.
8
4
9
5
## Cursor Positions
10
6
11
-
BlockNote allows you to keep track of the text cursor position in the editor, to get information about the block it's in and its surrounding blocks.
7
+
BlockNote keeps track of the text cursor position in the editor and exposes functions that let you retrieve it or change it.
12
8
13
9
## Text Cursor
14
10
15
-
The text cursor is the blinking vertical line you see when typing in the editor. In code, its position is represented using the following object:
11
+
The text cursor is the blinking vertical line you see when typing in the editor. BlockNote uses `TextCursorPosition` objects to give you information about the block it's in as well as those around it:
0 commit comments