File tree Expand file tree Collapse file tree 6 files changed +401
-311
lines changed Expand file tree Collapse file tree 6 files changed +401
-311
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,12 @@ const renderElement = ({
88
88
</ pre >
89
89
) ;
90
90
case "yaml" :
91
- break ;
91
+ case "toml" :
92
+ return (
93
+ < pre >
94
+ < code { ...attributes } > { children } </ code >
95
+ </ pre >
96
+ ) ;
92
97
case "definition" :
93
98
break ;
94
99
case "footnoteDefinition" :
Original file line number Diff line number Diff line change @@ -106,7 +106,12 @@ export default forwardRef(
106
106
</ pre >
107
107
) ;
108
108
case "yaml" :
109
- break ;
109
+ case "toml" :
110
+ return (
111
+ < pre >
112
+ < code { ...attributes } > { children } </ code >
113
+ </ pre >
114
+ ) ;
110
115
case "definition" :
111
116
break ;
112
117
case "footnoteDefinition" :
Original file line number Diff line number Diff line change @@ -3,15 +3,24 @@ import { Node } from "slate";
3
3
import unified from "unified" ;
4
4
import markdown from "remark-parse" ;
5
5
import gfm from "remark-gfm" ;
6
+ import frontmatter from "remark-frontmatter" ;
6
7
import stringify from "remark-stringify" ;
7
8
import { remarkToSlate , slateToRemark } from "../src" ;
8
9
import SlateEditor from "./components/slate-editor" ;
9
10
import TextEditor from "./components/text-editor" ;
10
11
import Text from "./components/text" ;
11
12
import text from "../fixture/article.md" ;
12
13
13
- const toSlateProcessor = unified ( ) . use ( markdown ) . use ( gfm ) . use ( remarkToSlate ) ;
14
- const toRemarkProcessor = unified ( ) . use ( slateToRemark ) . use ( gfm ) . use ( stringify ) ;
14
+ const toSlateProcessor = unified ( )
15
+ . use ( markdown )
16
+ . use ( gfm )
17
+ . use ( frontmatter )
18
+ . use ( remarkToSlate ) ;
19
+ const toRemarkProcessor = unified ( )
20
+ . use ( slateToRemark )
21
+ . use ( gfm )
22
+ . use ( frontmatter )
23
+ . use ( stringify ) ;
15
24
16
25
const toSlate = ( s : string ) => toSlateProcessor . processSync ( s ) . result as Node [ ] ;
17
26
const toMd = ( value : Node [ ] ) => {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Value } from "slate_legacy";
3
3
import unified from "unified" ;
4
4
import markdown from "remark-parse" ;
5
5
import gfm from "remark-gfm" ;
6
+ import frontmatter from "remark-frontmatter" ;
6
7
import stringify from "remark-stringify" ;
7
8
import { remarkToSlateLegacy , slateToRemarkLegacy } from "../src" ;
8
9
import SlateEditor from "./components/slate0.47-editor" ;
@@ -13,10 +14,12 @@ import text from "../fixture/article.md";
13
14
const toSlateProcessor = unified ( )
14
15
. use ( markdown )
15
16
. use ( gfm )
17
+ . use ( frontmatter )
16
18
. use ( remarkToSlateLegacy ) ;
17
19
const toRemarkProcessor = unified ( )
18
20
. use ( slateToRemarkLegacy )
19
21
. use ( gfm )
22
+ . use ( frontmatter )
20
23
. use ( stringify ) ;
21
24
22
25
const toSlate = ( s : string ) =>
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : " This is frontmatter"
3
+ date : 2020-04-30 12:34
4
+ categories : [JavaScript, React]
5
+ ---
6
+
1
7
# heading 1
2
8
3
9
## heading 2
You can’t perform that action at this time.
0 commit comments