From 7f119f3c2c584f3288e8365aac313cce419a1441 Mon Sep 17 00:00:00 2001 From: Edaz Date: Sun, 26 Dec 2021 17:24:28 +1300 Subject: [PATCH] Fix some errors --- packages/marked-renderer-text/README.md | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/packages/marked-renderer-text/README.md b/packages/marked-renderer-text/README.md index 88f009a..cd95b12 100644 --- a/packages/marked-renderer-text/README.md +++ b/packages/marked-renderer-text/README.md @@ -8,6 +8,8 @@ markdown to plain text. Can be useful for when you want to show a preview snippet of an article (or anything written in markdown) without any rich formatting. +Includes Typescript types. + ## Usage ```bash @@ -31,30 +33,15 @@ things */ ``` -### Typescript - -In my testing this works fine with typescript out of the box - you can import it -like this - -```ts -import { renderToText } from "marked-renderer-text"; -``` - -and use it like normal. Because it's a really simple package, Typescript seems -to magically infer all of the types. - -If you run into any problems using this with typescript, open an issue and I'll -add proper type definitions. - ## Options -You can enable fancy mode by passing `true` to the `renderToText()` function. +You can enable fancy mode by passing `true` as the first argument when initialising the class. ```js const { marked } = require("marked"); const RenderToText = require("marked-renderer-text"); const testText = `# Title\n**bold text**\n- A\n- List\n- *of*\n- ~~things~~`; -marked.use({ renderer: new RenderToText() }); +marked.use({ renderer: new RenderToText(true) }); /* Title @@ -67,3 +54,6 @@ BOLD TEXT */ ``` + +You can pass any normal marked renderer options as the second paramater (if you don't want to enable fancy mode, you should pass `false` as the first parameter when doing this). +