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
Copy file name to clipboardExpand all lines: README.md
+39-17Lines changed: 39 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -35,23 +35,42 @@ rules: [
35
35
Usage in your markdown:
36
36
--
37
37
38
-
Loader enhances the markdown syntax. Like `code` lang extended property.
38
+
Loader enhances the markdown syntax. Like `code` lang extended property. Each time you use any of the next code chunks, you got render of the contained code.
39
39
40
-
- Use code block with language
41
-
` ```js{eval} `
42
-
to eval some script at the beginning of the document.
40
+
-`js{eval}` To eval some script at the beginning of the document.
43
41
44
-
- Use code block with language
45
-
` ```js{render} `
46
-
to inline render React component from the code.
42
+
-`js{render}` To inline render React component from the code.
47
43
48
-
- Use code block with language
49
-
` ```js{+render}`
50
-
to display the code and render the code both
44
+
-`js{+render}` To display the code and render the code both
51
45
52
-
- Use code block with language
53
-
` ```js{render+}`
54
-
to render the code, and then display the code
46
+
-`js{render+}` to render the code, and then display the code
47
+
48
+
## Import markdown
49
+
50
+
As the result, you will get high-grade React Component.
51
+
52
+
```js
53
+
importReactfrom'react';
54
+
importReactDomfrom'react-dom';
55
+
importReadmefrom'./Readme.md';
56
+
57
+
ReactDom.render(
58
+
<Readme />,
59
+
document.getElementById('root')
60
+
)
61
+
```
62
+
63
+
As a normal React component, it can accept props.
64
+
65
+
```js
66
+
<Readme version="v1.0.0"/>
67
+
```
68
+
69
+
And markdown inline-components can use this props.
70
+
71
+
```js
72
+
<Version>{props.version}</Version>
73
+
```
55
74
56
75
## Advanced configuration
57
76
@@ -104,7 +123,7 @@ module.exports = {
104
123
105
124
### AST renderer
106
125
107
-
In super-advanced way you can add your custom logic to render AST to javascript.
126
+
In super-advanced way you can add your custom logic to render AST to javascript. Also you can add some initial code to the evalChunks.
108
127
109
128
```js
110
129
{
@@ -113,19 +132,22 @@ In super-advanced way you can add your custom logic to render AST to javascript.
You got the function `defaultRenderer` as the third argument, it provides you to render AST with the native logic, but you can manually convert AST to javascript code.
0 commit comments