@@ -35,7 +35,7 @@ const ExampleComponent = () => {
35
35
36
36
useEffect (() => {
37
37
setMarkdownSource (' # markdown header' );
38
- }, [])
38
+ }, []);
39
39
40
40
return reactContent ;
41
41
};
@@ -66,6 +66,23 @@ const ExampleComponent = () => {
66
66
export default ExampleComponent ;
67
67
```
68
68
69
+ ### Server side rendering
70
+
71
+ ``` tsx
72
+ import React from ' react' ;
73
+ import { useRemarkSync } from ' react-remark' ;
74
+
75
+ const ExampleComponent = () => {
76
+ const reactContent = useRemarkSync (' # markdown header' );
77
+
78
+ return reactContent ;
79
+ };
80
+
81
+ export default ExampleComponent ;
82
+ ```
83
+
84
+ :notebook : Note that some remark plugins are async, these plugins will error if used with ` useRemarkSync ` .
85
+
69
86
[ More examples of usage as hook in storybook.] ( https://remarkjs.github.io/react-remark/?path=/story/remark-hook )
70
87
71
88
### As a component
@@ -160,7 +177,7 @@ const [reactContent, setMarkdownSource] = useRemark({
160
177
rehypePlugins: [rehypeSlug , rehypeAutoLinkHeadings ],
161
178
rehypeReactOptions: {
162
179
components: {
163
- p : props => <p className = " custom-paragraph" { ... props } />,
180
+ p : ( props ) => <p className = " custom-paragraph" { ... props } />,
164
181
},
165
182
},
166
183
});
@@ -183,7 +200,7 @@ import rehypeAutoLinkHeadings from 'rehype-autolink-headings';
183
200
rehypePlugins = { [rehypeSlug , rehypeAutoLinkHeadings ]}
184
201
rehypeReactOptions = { {
185
202
components: {
186
- p : props => <p className = " custom-paragraph" { ... props } />,
203
+ p : ( props ) => <p className = " custom-paragraph" { ... props } />,
187
204
},
188
205
}}
189
206
>
0 commit comments