Is it possible to disable a plugin for a block of Markdown or entire file?

I’ve made a plugin that transforms links using registerMarkdownPostProcessor. A user of it is asking if it’s possible to disable the plugin for specific links. I know I could hack something in that would accomplish this, but I wanted to make sure this didn’t already exist.

I was thinking a comment would work best. Something like:

%%disable:plugin-id%%
[some link](https://example.com)

%%disable-start:plugin-id%%
[some link](https://example.com)
[some link](https://example.com)
%%disable-end%%

Currently, this is an issue on my end, because comments are removed by the time my post processor function is called, so I don’t know if it’s been added or not.

Could also have something in the front matter to disable a plugin for a whole file.

Seems like this could be useful for other plugins as well, so maybe this is more of a feature request. But I’d love to hear if anyone has already done something similar to this, or if there’s already an official solution. I’m new to the plugin API, so I’m still finding my way around it, so I may have missed something obvious. Thanks!

1 Like