From 9805216b21b6251514478a0c3097b284a83506f9 Mon Sep 17 00:00:00 2001 From: Tan Nhu Date: Thu, 29 Sep 2022 17:33:46 -0700 Subject: [PATCH] Update README.md (#204) Fix a bug in `Disable Header links` example section. Given a heading: ``` # A demo of `react-markdown` ``` Example will yield: ```

A demo of

``` Which is not correct, the text `react-markdown` is ignored. Withe the fix, example will yield correct output: ```

A demo of react-markdown

``` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9232035c..660e2148 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ function Demo() { source={source} rehypeRewrite={(node, index, parent) => { if (node.tagName === "a" && parent && /^h(1|2|3|4|5|6)/.test(parent.tagName)) { - parent.children = [parent.children[1]]; + parent.children = parent.children.slice(1) } }} />