How to unregister a code block post processor

Things I have tried

  • Read the Markdown post processing documentation.
  • Searched the forums. Only found this post, which references a function (unregisterCodeBlockPostProcessor) that isn’t in the API. I checked to see if it was just undocumented and was defined on the Plugin object, but it was undefined.
  • Checked the documentation for anything that seems related to unregister/deregister.

What I’m trying to do

I’m trying to update an existing plugin to make the code block language name (the first argument to registerMarkdownCodeBlockProcessor) configurable. I’d like to do this without requiring a reload, meaning that on change, the old processor would need to be unregistered and a new one registered.

However, I can’t figure out how to unregister the old one. The registerMarkdownCodeBlockProcessor function returns a MarkdownPostProcessor, but I can’t find a way to use this to unregister. The Plugin class doesn’t seem to have any unregister functions.

The only seemingly relevant function I see in the Obsidian API is MarkdownPreviewRenderer. unregisterPostProcessor, but it doesn’t seem to actually do the unregister (I checked both reading and live preview modes).


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.