mirror of https://github.com/stelzo/typst.git
Do not take empty lines into account when computing `raw` block dedent (#1676)
This commit is contained in:
parent
78f96f844b
commit
507efc3a1c
|
|
@ -565,6 +565,9 @@ impl Raw {
|
|||
let dedent = lines
|
||||
.iter()
|
||||
.skip(1)
|
||||
.filter(|line| !line.chars().all(char::is_whitespace))
|
||||
// The line with the closing ``` is always taken into account
|
||||
.chain(lines.last())
|
||||
.map(|line| line.chars().take_while(|c| c.is_whitespace()).count())
|
||||
.min()
|
||||
.unwrap_or(0);
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 21 KiB |
|
|
@ -4,6 +4,10 @@
|
|||
// No extra space.
|
||||
`A``B`
|
||||
|
||||
---
|
||||
// Empty raw block.
|
||||
Empty raw block:``.
|
||||
|
||||
---
|
||||
// Typst syntax inside.
|
||||
```typ #let x = 1``` \
|
||||
|
|
@ -48,6 +52,22 @@ The keyword ```rust let```.
|
|||
C
|
||||
```
|
||||
|
||||
---
|
||||
// Do not take empty lines into account when computing dedent.
|
||||
```
|
||||
A
|
||||
|
||||
B
|
||||
```
|
||||
|
||||
---
|
||||
// Take last line into account when computing dedent.
|
||||
```
|
||||
A
|
||||
|
||||
B
|
||||
```
|
||||
|
||||
---
|
||||
// Text show rule
|
||||
#show raw: set text(font: "Roboto")
|
||||
|
|
|
|||
Loading…
Reference in New Issue