markdown-it-async
Advanced tools
Comparing version
@@ -15,2 +15,8 @@ import MarkdownIt, { Options, PresetName, PluginSimple as PluginSimple$1, PluginWithOptions as PluginWithOptions$1, PluginWithParams as PluginWithParams$1 } from 'markdown-it'; | ||
highlight?: ((str: string, lang: string, attrs: string) => string | Promise<string>) | null | undefined; | ||
/** | ||
* Emit warning when calling `md.render` instead of `md.renderAsync`. | ||
* | ||
* @default false | ||
*/ | ||
warnOnSyncRender?: boolean; | ||
} | ||
@@ -31,2 +37,3 @@ | ||
use(plugin: PluginWithParams$1, ...params: any[]): this; | ||
render(src: string, env?: any): string; | ||
renderAsync(src: string, env?: any): Promise<string>; | ||
@@ -33,0 +40,0 @@ } |
{ | ||
"name": "markdown-it-async", | ||
"type": "module", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "_description_", | ||
@@ -6,0 +6,0 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", |
@@ -29,2 +29,14 @@ # markdown-it-async | ||
## Opt-in Warning | ||
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. | ||
```ts | ||
const md = MarkdownItAsync({ | ||
warnOnSyncRender: true | ||
}) | ||
md.render('Hello') // This will throw a conole warning | ||
``` | ||
## How it works? | ||
@@ -31,0 +43,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
19420
7.27%217
9.6%71
20.34%