From ae8e7f5ef9562ad3c6b045043e111323ab852956 Mon Sep 17 00:00:00 2001 From: d3m1d0v Date: Wed, 27 Nov 2024 17:07:11 +0300 Subject: [PATCH] feat: enable inline directives by default --- README.md | 2 -- src/index.ts | 12 ------------ tests/src/directive.test.ts | 7 +++---- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 11cd388..bf434aa 100644 --- a/README.md +++ b/README.md @@ -100,8 +100,6 @@ All of parameters groups – `[]`, `()`, `{}` – are optional, but their order - `()` – used for something like required identifier (id, url, etc.); - `{}` – used to pass optional named arguments / attributes / `key=value` pairs. -> Note: inline directives disabled by default. You can enable them using `enableInlineDirectives()` helper. - ## Helpers ### Enable or disable some of directive types diff --git a/src/index.ts b/src/index.ts index dfac3bf..02a9fb5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,8 +2,6 @@ import type MarkdownIt from 'markdown-it'; import directivePlugin from 'markdown-it-directive'; -import {disableInlineDirectives} from './helpers'; - export { enableBlockDirectives, enableInlineDirectives, @@ -33,18 +31,8 @@ export type { InlineDirectiveHandler, } from './types'; -// eslint-disable-next-line valid-jsdoc -/** - * Inline directives are disabled by default. - * - * They will be enabled after this error is fixed: https://github.com/hilookas/markdown-it-directive/issues/5 - * - * To enable inline directives use `enableInlineDirectives()` helper. - */ export const directiveParser = (): MarkdownIt.PluginSimple => { return (md) => { directivePlugin(md); - - disableInlineDirectives(md); }; }; diff --git a/tests/src/directive.test.ts b/tests/src/directive.test.ts index ee56570..a0e752f 100644 --- a/tests/src/directive.test.ts +++ b/tests/src/directive.test.ts @@ -10,7 +10,6 @@ import { directiveParser, disableBlockDirectives, disableInlineDirectives, - enableInlineDirectives, registerContainerDirective, registerInlineDirective, registerLeafBlockDirective, @@ -20,14 +19,14 @@ import { const html = (text: string, {plugins}: {plugins?: MarkdownIt.PluginSimple[]} = {}) => { const {result} = transform(text, { - plugins: [directiveParser(), enableInlineDirectives, ...(plugins || [])], + plugins: [directiveParser(), ...(plugins || [])], }); return result.html; }; describe('Directive', () => { - it('should not parse inline directive by default', () => { + it.skip('should not parse inline directive by default', () => { const md = new MarkdownIt().use(directiveParser()); const inlineHandler = jest.fn(() => false); const leafHandler = jest.fn(() => false); @@ -518,7 +517,7 @@ describe('Directive', () => { describe('tokenizeInlineContent', () => { it('should parse content in inline directive', () => { - const md = new MarkdownIt().use(directiveParser()).use(enableInlineDirectives); + const md = new MarkdownIt().use(directiveParser()); registerInlineDirective(md, 'inl', (state, params) => { if (!params.content) { return false;