mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Fix block spacing
This commit is contained in:
parent
fa4878f7d0
commit
b469f30c83
@ -466,8 +466,12 @@ impl<'a> FlowBuilder<'a> {
|
||||
self.0.push(spacing.pack(), styles);
|
||||
}
|
||||
|
||||
let above = BlockElem::above_in(styles);
|
||||
let below = BlockElem::below_in(styles);
|
||||
let (above, below) = if let Some(block) = content.to::<BlockElem>() {
|
||||
(block.above(styles), block.below(styles))
|
||||
} else {
|
||||
(BlockElem::above_in(styles), BlockElem::below_in(styles))
|
||||
};
|
||||
|
||||
self.0.push(above.pack(), styles);
|
||||
self.0.push(content.clone(), styles);
|
||||
self.0.push(below.pack(), styles);
|
||||
|
BIN
tests/ref/layout/block-spacing.png
Normal file
BIN
tests/ref/layout/block-spacing.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
9
tests/typ/layout/block-spacing.typ
Normal file
9
tests/typ/layout/block-spacing.typ
Normal file
@ -0,0 +1,9 @@
|
||||
// Test block spacing.
|
||||
|
||||
---
|
||||
#set block(spacing: 10pt)
|
||||
Hello
|
||||
|
||||
There
|
||||
|
||||
#block(spacing: 20pt)[Further down]
|
Loading…
x
Reference in New Issue
Block a user