From b5c2dc7662cfa45cf0e0bd75e45125bfdcf7019b Mon Sep 17 00:00:00 2001 From: Zikun Wang <68682076+zikunw@users.noreply.github.com> Date: Sun, 3 Sep 2023 17:30:57 -0400 Subject: [PATCH] Fixed retext-english usage retext-english now provides a Parser object. The previous code will not run with the current version. --- doc/learn/create-an-editor.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/learn/create-an-editor.md b/doc/learn/create-an-editor.md index 9fd0a672f336..1db4f997db3f 100644 --- a/doc/learn/create-an-editor.md +++ b/doc/learn/create-an-editor.md @@ -269,7 +269,7 @@ Change `index.js` like so: import diff from 'virtual-dom/diff.js' import patch from 'virtual-dom/patch.js' +import {unified} from 'unified' -+import retextEnglish from 'retext-english' ++import retextEnglish, {Parser} from 'retext-english' +const processor = unified().use(retextEnglish) const root = document.querySelector('#root') @@ -281,7 +281,7 @@ Change `index.js` like so: - function parse() {} + function parse(value) { -+ return processor.runSync(processor.parse(value)) ++ return processor.runSync(new Parser().parse(value)) + } function highlight() {} @@ -304,7 +304,7 @@ it: --- a/index.js +++ b/index.js @@ -32,5 +32,19 @@ function render(text) { - return processor.runSync(processor.parse(value)) + return processor.runSync(new Parser().parse(value)) } - function highlight() {}