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
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,18 @@ const md = MarkdownItAsync({
26
26
const html =awaitmd.renderAsync(markdown)
27
27
```
28
28
29
+
## Opt-in Warning
30
+
31
+
If you integrate this package into your project, and want to make sure you have every usage of `md.render` migrated to `md.renderAsync`, you can enable the `warnOnSyncRender` option.
32
+
33
+
```ts
34
+
const md =MarkdownItAsync({
35
+
warnOnSyncRender: true
36
+
})
37
+
38
+
md.render('Hello') // This will throw a conole warning
39
+
```
40
+
29
41
## How it works?
30
42
31
43
This package is a thin wrapper around `markdown-it` to support async highlight function. It uses [the approach suggested in `markdown-it`'s docs](https://github.com/markdown-it/markdown-it/blob/master/docs/development.md#i-need-async-rule-how-to-do-it), by putting placeholders in sync mode and then replace them with async results.
0 commit comments