How to override MacroBrowser postPreview function?

Hi Alex, thanks for your reply.

I’ve done what you wrote above and the preview still shows the string instead of the diagram.

@Override
	public String execute(Map<String, String> parameters, String body, ConversionContext context)
			throws MacroExecutionException {

...

String code = null;
		if (parameters != null){
			code = parameters.get("Code");
		}
if (ConversionContextOutputType.PDF.value().equals(outputType)
				|| ConversionContextOutputType.WORD.value().equals(outputType)
				|| ConversionContextOutputType.FEED.value().equals(outputType)
				|| ConversionContextOutputType.EMAIL.value().equals(outputType)) {
			return renderImage(code);
		} else {
			pageBuilderService.assembler().resources().requireContext("mermaid-plugin");
			return renderDynamic(code, theme, width);
		}
}

This is the string that is returned at the end of the renderDynamic(code, theme, width) function:

[INFO] [talledLocalContainer] <div class=“mermaid” style=“overflow-x: auto; width: 100%”>
[INFO] [talledLocalContainer] %%{init: {‘theme’:‘default’}}%%
[INFO] [talledLocalContainer] sequenceDiagram
[INFO] [talledLocalContainer] Alice->>+John: Hello John, how are you?
[INFO] [talledLocalContainer] Alice->>+John: John, can you hear me?
[INFO] [talledLocalContainer] John–>>-Alice: Hi Alice, I can hear you!
[INFO] [talledLocalContainer] John–>>-Alice: I feel great!
[INFO] [talledLocalContainer] </div>

which is the same as when I try to render the diagram from the body.