Also the raw behavior is weird, try adding a blank line below XYZ, there will be no change in output document. But adding another line will, but now “two lines in raw” is “one line in output raw”, this is not counting the line I wish to remove.
Thank you.
This is the source code:
#lorem(40)
#par(leading: 0.4em)[
```
START
_ _ _ _ __ __ _ _ _
| | | | ___| | | ___ \ \ / /__ _ __| | __| | |
| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | |
| _ | __/ | | (_) | \ V V / (_) | | | | (_| |_|
|_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_(_)
This is test, hello you
are not the man.
AB
```
]
```
CD
_ _ _ _ __ __ _ _ _
| | | | ___| | | ___ \ \ / /__ _ __| | __| | |
| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | |
| _ | __/ | | (_) | \ V V / (_) | | | | (_| |_|
|_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_(_)
This is test, hello you
are not the man.
XYZ
```
#lorem(40)
These spaces come from block spacing that is automatically added before and after all kinds of blocks, including these code blocks. You can configure them with the spacing, above and below properties of the block element. To remove this spacing, you can use a show-set rule and set the values to the same value used as the paragraph’s leading (by default 0.65em):
#show raw.where(block: true): set block(
above: 0.65em,
below: 0.65em
)
You can’t currently use the spacing property in this case, as paragraphs themselves are also blocks and their block spacing would override the custom spacing you set. This may change with the next Typst version though.
With the above, the additional spacing vanishes, so as you already found out, you then need to append two line breaks in the raw block to end the resulting code with an empty line.