8000 Fixed retext-english usage · unifiedjs/unifiedjs.github.io@b5c2dc7 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5c2dc7

Browse files
committed
Fixed retext-english usage
retext-english now provides a Parser object. The previous code will not run with the current version.
1 parent 9379bc3 commit b5c2dc7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/learn/create-an-editor.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Change `index.js` like so:
269269
import diff from 'virtual-dom/diff.js'
270270
import patch from 'virtual-dom/patch.js'
271271
+import {unified} from 'unified'
272-
+import retextEnglish from 'retext-english'
272+
+import retextEnglish, {Parser} from 'retext-english'
273273

274274
+const processor = unified().use(retextEnglish)
275275
const root = document.querySelector('#root')
@@ -281,7 +281,7 @@ Change `index.js` like so:
281281

282282
- function parse() {}
283283
+ function parse(value) {
284-
+ return processor.runSync(processor.parse(value))
284+
+ return processor.runSync(new Parser().parse(value))
285285
+ }
286286

287287
function highlight() {}
@@ -304,7 +304,7 @@ it:
304304
--- a/index.js
305305
+++ b/index.js
306306
@@ -32,5 +32,19 @@ function render(text) {
307-
return processor.runSync(processor.parse(value))
307+
return processor.runSync(new Parser().parse(value))
308308
}
309309

310310
- function highlight() {}

0 commit comments

Comments
 (0)
0