From e4b5c8e5453403cab36f996e53b884003d43831a Mon Sep 17 00:00:00 2001 From: Arve Seljebu Date: Sun, 29 Nov 2015 13:48:40 +0100 Subject: [PATCH] add note about requiring markdown-it I've stumbled upon several plugins ([toc and anchor](https://github.com/MoOx/markdown-it-toc-and-anchor/blob/master/src/index.js#L1), [named headers](https://github.com/leff/markdown-it-named-headers/blob/master/index.js#L4), [anchor](https://github.com/valeriangalliat/markdown-it-anchor/blob/master/index.es6.js#L3)) which require markdown-it directly. In this case, it seems like markdown-it-anchor was the first to require markdown-it, then the others have followed. markdown-it-named-headers doesn't even use `Token`. Tldr; I think this note is useful for fresh plugin writers. --- docs/development.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/development.md b/docs/development.md index 784194e..384baa1 100644 --- a/docs/development.md +++ b/docs/development.md @@ -18,6 +18,8 @@ Prior to continue, make sure you've read: block & inline rules are usually faster. - Sometime it's enougth to modify renderer only (for example, to add header IDs or `target="_blank"` for the links). + - Plugins should use passed arguments to access markdown-it. Plugins should + *never* require markdown-it directly. 2. Search existing [plugins](https://www.npmjs.org/browse/keyword/markdown-it-plugin) or [rules](https://github.com/markdown-it/markdown-it/tree/master/lib),