@mdxeditor/editor 0.2.0 → 0.3.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
@@ -1,88 +1,27 @@
1
- # Lexical MDX
1
+ # MDX Editor
2
2
 
3
- This project aims to develop a set of packages for editing of [MDX](https://mdxjs.com/) in [Lexical](https://lexical.dev/).
3
+ ![npm](https://img.shields.io/npm/v/@mdxeditor/editor)
4
+ ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@mdxeditor/editor)
4
5
 
5
- If you're using markdown with Lexical and you need help or would like to collaborate, contact me over the [email in my profile](https://github.com/petyosi/) or [over Discord](https://discord.com/users/727775297667203073).
6
+ > Because markdown editing can be even more delightful.
6
7
 
7
- ## Markdown import/export
8
-
9
- ![npm](https://img.shields.io/npm/v/@virtuoso.dev/lexical-mdx-import-export)
10
- ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/minzip/@virtuoso.dev/lexical-mdx-import-export)
11
-
12
- The markdown import/export utility supports **extensible** and **configurable** markdown interoperability with Lexical.
13
-
14
- Unlike the built-in Lexical support, this implementation uses [Markdown Abstract Syntax Tree](https://github.com/syntax-tree/mdast) with the mdx extension turned on.
15
- This allows support for html tags (like `<u>underline</u>`) and the editing and configuration of React components. It also supports configuration of the markdown output format.
16
-
17
- Out of the box, the following syntax is supported:
18
-
19
- - Paragraphs
20
- - Bold, italic, underline formatting
21
- - Headings
22
- - Ordered and unordered lists
23
- - Nested lists
24
- - Links
25
- - Block quotes
26
- - Inline code and code blocks
27
- - Images
28
- - Horizontal rules
29
-
30
- ### Usage
31
-
32
- To add the package to your project, install it with
33
-
34
- ```bash
35
- npm install --save @virtuoso.dev/lexical-mdx-import-export
36
- ```
37
-
38
- To import markdown, call the respective function in the initial config:
8
+ MDX Editor is an open-source React component that allows users to author markdown documents naturally. Just like in Google docs or Notion. [See the live demo](https://mdxeditor.dev/editor/demo) that has the default features turned on. It supports most (if not all) of the markdown syntax, including tables, images, code blocks, etc. It also allows users to edit JSX components with a dedicated property editor.
39
9
 
40
10
  ```jsx
41
- const markdown = '# hello world'
42
- const initialConfig = {
43
- editorState: () => {
44
- importMarkdownToLexical($getRoot(), mardkown)
45
- },
46
- //...
47
- }
48
-
49
- //....
50
- <LexicalComposer initialConfig={initialConfig}>
51
- ```
52
-
53
- To export markdown, read the editor state, and call the function with the root node:
11
+ import {MDXEditor} from '@mdxeditor/editor';
54
12
 
55
- ```jsx
56
- //...
57
- state.read(() => {
58
- console.log(exportMarkdownFromLexical({root : $getRoot()}))
59
- })
60
- //
13
+ export default function App() {
14
+ return <MDXEditor markdown={'# Hello World'} />;
15
+ }
61
16
  ```
17
+ ## Get Started
62
18
 
63
- Check [the live example with the supported markdown syntax](https://codesandbox.io/s/lexical-markdown-import-export-0p1dn0?file=/src/App.tsx) supported first.
64
-
65
-
66
- ### Configure markdown export formatting
67
-
68
- The `exportMarkdownFromLexical` method accepts an optional [`options`](https://github.com/syntax-tree/mdast-util-to-markdown#options)
69
- parameter that controls the markdown formatting. Check the link above for detialed documentation from mdast.
70
-
71
- ### Support additional nodes through visitors
72
-
73
- Both the import and export are implemented with visitor objects. The functions accept an optional Array parameter of the visitors to be applied to the syntax tree.
74
-
75
- You can take the default array of visitors exported as `MdastVisitors` and, `LexicalVisitors` and append your own custom visitors or replace the default ones.
76
-
77
- The easiest way to create your own visitor is to use the code of a one that's similar to what you need and use it as a starting point.
78
-
79
- - [MdastVisitors source code](https://github.com/virtuoso-dev/lexical-mdx/blob/main/packages/import-export/src/importMarkdownToLexical.ts)
80
- - [LexicalVisitors source code](https://github.com/virtuoso-dev/lexical-mdx/blob/main/packages/import-export/src/exportMarkdownFromLexical.ts)
19
+ The best place to get started using the component is the [documentation](https://mdxeditor.dev/editor/docs/getting-started).
81
20
 
82
- ## Support
21
+ ## Help and support
83
22
 
84
- Contact me over the [email in my profile](https://github.com/petyosi/) or [over Discord](https://discord.com/users/727775297667203073).
23
+ Should you encounter any issues, please [create an issue](https://github.com/mdx-editor/editor/issues), but check if there's something similar already open first.
85
24
 
86
25
  ## License
87
26
 
88
- MIT License.
27
+ MIT &copy; Petyo Ivanov.