Skip to content

Commit be8f856

Browse files
claude: Consolidate listing alignment to show rule, add position tests
Remove the old #set align(left) workaround from the wideblock path in floatreftarget.lua. The document-level show rule injection: #show figure.where(kind: "quarto-float-lst"): set align(start) now handles all listing alignment, making the inline workaround redundant. Add ensurePdfTextPositions tests to fullwidth-listing.qmd: - Verify listing caption is left-aligned with body text - Verify code token "docker" is left-aligned near page left edge (~47pt) The Page element with edge:"left" allows testing alignment against page boundaries. The test confirms listings are not centered. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b211a1c commit be8f856

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎src/resources/filters/customnodes/floatreftarget.lua‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,10 +1061,6 @@ end, function(float)
10611061
local wideblock_side = getWideblockSide(float.classes)
10621062
if wideblock_side then
10631063
local content = quarto.utils.as_blocks(float.content or {})
1064-
-- Listings should not be centered inside the figure
1065-
if ref == "lst" then
1066-
content:insert(1, pandoc.RawBlock("typst", "#set align(left)"))
1067-
end
10681064
local caption_location = cap_location(float)
10691065
if caption_location ~= "top" and caption_location ~= "bottom" then
10701066
caption_location = "bottom"

‎tests/docs/smoke-all/typst/margin-layout/fullwidth-listing.qmd‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ _quarto:
2020
- subject: "MARGIN-NOTE-LISTING"
2121
relation: rightOf
2222
object: "Full Width Listing"
23+
# Listing caption should be left-aligned with body text (not centered)
24+
- subject: "FULLWIDTH-CSS-STYLES"
25+
relation: leftAligned
26+
object: "This tests code listings"
27+
tolerance: 10
28+
# Full-page listing code should be near left page edge (within body margin)
29+
- subject: "docker"
30+
relation: leftAligned
31+
object: { role: "Page", page: 1, edge: "left" }
32+
tolerance: 50 # Body margin ~47pt from page edge
2333
- # Negative: fullwidth listing caption NOT rightOf margin note
2434
- subject: "FULLWIDTH-CSS-STYLES"
2535
relation: rightOf

0 commit comments

Comments
 (0)