Is there a 'text block', similar to 'code block'?

I have a block of text and would like to make it have a background color, the same with what code blocks look like. I cannot use ‘code block’ because it will erase all the formats. For example,

- list 1
- list 2
- list 3
$ x = x^2 $

The code block will remove the list format and LaTeX format. Thanks.

No. You can use HTML (which means HTML only inside that block, no Markdown), or you could check Community Plugins for something that will let you attach CSS classes to blocks.

If you really want the background color, you could use custom callouts. It’s messy though because you’ll need to have a > at the start of each line.

1 Like

You can create a custom callout that looks like a codeblock.

Add the following to your custom .css file

.callout[data-callout="math"] {
    padding: 0px ;
    background-color:#242424
}
.callout-title-inner, .callout-icon {
  display:none;
}

This will replicate a code block, including the same background color.
You can change the name from “math” to anything that is easy for you.

I chose to hide the title name and icon with:

.callout-title-inner, .callout-icon {
  display:none;
}

You can remove this if you want to make the callout collapsible. Otherwise you won’t be able to see the title to click on it.

Remember to add > to a new line including line breaks. Now everything will display correctly

> [!math]
> - Line 1
> - Line 2
> - Line 3
> $$x= x^2 $$
1 Like