marked icon indicating copy to clipboard operation
marked copied to clipboard

Confusing/contradicting documentation regarding extensions

Open ronny-rentner opened this issue 1 year ago • 3 comments

On https://marked.js.org/using_pro#use it's being said I can use marked.use(myExtension, extension2, extension3); to load my custom extension but this doesn't work.

On https://marked.js.org/using_pro#extensions you learn that you actually have to use marked.use({ extensions: [description] }); with the key extensions.

The first version does not work but there's also no error message. Just nothing happens which is bad because you start guessing around why nothing happens and why your extension is not being used.

ronny-rentner avatar Oct 14 '24 08:10 ronny-rentner

There is a difference between "Marked Extension" and "Custom Extension" see #3182 and The two hardest things in computer science

UziTech avatar Oct 14 '24 14:10 UziTech

And this difference is necessary? What's the idea behind it? Why not treat any kind of extension the same and simplify things?

ronny-rentner avatar Oct 15 '24 09:10 ronny-rentner

A marked extension can have multiple custom extensions, tokenizer extensions, and renderer extensions. Yes this is necessary mostly for legacy reasons. It would be great to clean it up but there will be many extensions that would break.

UziTech avatar Oct 15 '24 14:10 UziTech