Add a code block which displays error message

Suppose I want to add a code block that displays an error in red color when ‘error’ is appended to the three backticks. How do I do it in obsidian?

I see some plugins do similar things, but exactly how to do so I’m not sure. You could however use something like:

As code:

> [!error]+ 
> 
> ```c
> ...
>     int x = 1 / 0;
> ...
> ```

The + allows the callout to be expanded and collapsed. Alternatively use - to make the error render collapsed by default. Remove it to be non-collapsable.

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