Things I have tried
- looked through callouts page Use callouts - Obsidian Help
- searched reddit: https://www.reddit.com/r/ObsidianMD/search/?q=callout%20block&
- searched forum
What I’m trying to do
I wanted to insert html code (or any code containing >
) into a callout.
But the >
seems to escape the callout block and subsequent lines are not rendered as expected.
Here an example:
> [!example] Code Example
>```html
> <body>
> <h1>HTML First Program</h1>
> <p>HTML Hello World.</p>
> </body>
>```
is expected to be rendered as:
but is instead rendered as:
- the
h1
and the following lines are plain text and not inside the callout
One way to avoid this issue, is to insert a \
before the first >
before a block:
But it means that I can’t copy code as conveniently as before and have to always remove the \
.
Am I doing something wrong? How should I insert code into a callout correctly?
Note: There is a workaround using the admonition plugin, but I’d rather use callouts instead. Here the workaround for the code above that renders as expected:
```ad-example
~~~html
<body>
<h1>HTML First Program</h1>
<p>HTML Hello World.</p>
</body>
~~~