From 9c5e2edc1e2c1201fb6f44ff3f11c4dcb0915178 Mon Sep 17 00:00:00 2001 From: Ben Judson Date: Wed, 3 Oct 2018 16:35:21 -0500 Subject: [PATCH] remark-parse: improve turning off a tokenizer Closes GH-360. Reviewed-by: Titus Wormer --- packages/remark-parse/readme.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/remark-parse/readme.md b/packages/remark-parse/readme.md index 177223651..9de8104c5 100644 --- a/packages/remark-parse/readme.md +++ b/packages/remark-parse/readme.md @@ -390,16 +390,18 @@ The given `node`. ### Turning off a tokenizer In rare situations, you may want to turn off a tokenizer to avoid parsing -that syntactic feature. This can be done by deleting the tokenizer from +that syntactic feature. This can be done by replacing the tokenizer from your Parser’s `blockTokenizers` (or `blockMethods`) or `inlineTokenizers` (or `inlineMethods`). The following example turns off indented code blocks: ```js -delete remarkParse.Parser.prototype.blockTokenizers.indentedCode; +remarkParse.Parser.prototype.blockTokenizers.indentedCode = function () { return true }; ``` +Preferably, just use [this plugin](https://github.com/zestedesavoir/zmarkdown/tree/master/packages/remark-disable-tokenizers). + ## License [MIT][license] © [Titus Wormer][author]