registerMarkdownPostProcessor callback not called with Live Preview Mode

I want to develop a plugin to highlight certain words in a code block. I tried this example:

this.registerMarkdownPostProcessor((element, context) => {
            console.log("callback called");

By looking at the console log in dev tools (CTRL+SHIFT+I) I see that the callback is called when I switch to preview mode (CTRL+E) but it is not called if I am using live preview mode (or switch to live preview mode). How can I have the callback to be called also when using live preview mode?

See also:

According to this page:

  • If you want to change how to convert Markdown to HTML in the Reading view, consider building a Markdown post processor.
  • If you want to change how the document looks and feels in Live Preview, you need to build an editor extension.

So I guess I need to build an editor extension (in addition to the preview mode callback I registered with registerMarkdownPostProcessor()). It is not possible to post process live preview html without building an editor extension. Am I right? But building an editor extension seems more complex, so why is it needed? What makes live preview different from preview (reading) mode?

Correct, you need to write an editor extension.

Live Preview is way more complicated than reading mode, in fact they use a different engine.
In Live Preview you need to be able to edit content, in addition to viewing it, that makes it quote a bit more complex.