diff --git a/__tests__/__snapshots__/disabling-tokenizers.test.js.snap b/__tests__/__snapshots__/disabling-tokenizers.test.js.snap index 1dabad5d0..47c790eb3 100644 --- a/__tests__/__snapshots__/disabling-tokenizers.test.js.snap +++ b/__tests__/__snapshots__/disabling-tokenizers.test.js.snap @@ -67,3 +67,37 @@ Object { "type": "root", } `; + +exports[`disableTokenizers: {} disables a block tokenizer 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "type": "text", + "value": "# heading 1", + }, + ], + "type": "paragraph", + }, + ], + "type": "root", +} +`; + +exports[`disableTokenizers: {} disables an inline tokenizer 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "type": "text", + "value": "\`const js = true\`", + }, + ], + "type": "paragraph", + }, + ], + "type": "root", +} +`; diff --git a/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-callouts-without-surprises-1-snap.png b/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-callouts-without-surprises-1-snap.png index e1bb5c353..c1ee1044b 100644 Binary files a/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-callouts-without-surprises-1-snap.png and b/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-callouts-without-surprises-1-snap.png differ diff --git a/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-code-blocks-without-surprises-1-snap.png b/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-code-blocks-without-surprises-1-snap.png index e865a0d4b..3fce7e07a 100644 Binary files a/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-code-blocks-without-surprises-1-snap.png and b/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-code-blocks-without-surprises-1-snap.png differ diff --git a/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-tables-without-surprises-1-snap.png b/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-tables-without-surprises-1-snap.png index bf964346c..9200ce32e 100644 Binary files a/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-tables-without-surprises-1-snap.png and b/__tests__/browser/ci/markdown-test-js-visual-regression-tests-rdmd-syntax-renders-tables-without-surprises-1-snap.png differ diff --git a/__tests__/disabling-tokenizers.test.js b/__tests__/disabling-tokenizers.test.js index d7b7d63ba..dcf4c8d34 100644 --- a/__tests__/disabling-tokenizers.test.js +++ b/__tests__/disabling-tokenizers.test.js @@ -27,3 +27,17 @@ describe('disableTokenizers: "blocks"', () => { expect(markdown.mdast(md, opts)).toMatchSnapshot(); }); }); + +describe('disableTokenizers: {}', () => { + it('disables a block tokenizer', () => { + const opts = { disableTokenizers: { block: ['atxHeading'] } }; + const md = '# heading 1'; + expect(markdown.mdast(md, opts)).toMatchSnapshot(); + }); + + it('disables an inline tokenizer', () => { + const opts = { disableTokenizers: { inline: ['code'] } }; + const md = '`const js = true`'; + expect(markdown.mdast(md, opts)).toMatchSnapshot(); + }); +}); diff --git a/docs/tables.md b/docs/tables.md index f6301f5d8..c7dfa6bf2 100644 --- a/docs/tables.md +++ b/docs/tables.md @@ -54,8 +54,22 @@ Tables have been simplified to mirror a more standard implementation. We've also .markdown-body .rdmd-table th {} .markdown-body .rdmd-table td {} ``` -[block:html] -{ - "html": "" -} -[/block] + + diff --git a/options.js b/options.js index 94ebdd632..5fbac4ee3 100644 --- a/options.js +++ b/options.js @@ -77,11 +77,15 @@ const parseOptions = (userOpts = {}) => { if (opts.disableTokenizers in disableTokenizers) { opts = { ...opts, ...disableTokenizers[opts.disableTokenizers] }; - } else if (opts.disableTokenizers) { - throw new Error( - `opts.disableTokenizers "${opts.disableTokenizers}" not one of "${Object.keys(disableTokenizers)}"` - ); } + // @note: commenting out for now. While doing dev for @readme/editor, I would + // like fine-grained control of which tokenizers we are using. We might to + // remove that at some point? + // } else if (opts.disableTokenizers) { + // throw new Error( + // `opts.disableTokenizers "${opts.disableTokenizers}" not one of "${Object.keys(disableTokenizers)}"` + // ); + // } return opts; };