Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/changelog-1.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ All changes included in 1.7:
- ([#11860](https://github.com/quarto-dev/quarto-cli/issues/11860)): ES6 modules that import other local JS modules in documents with `embed-resources: true` are now correctly embedded.
- ([#1325](https://github.com/quarto-dev/quarto-cli/issues/1325)): Dark Mode pages should not flash light on reload. (Nor should Light Mode pages flash dark.)
- ([#12307](https://github.com/quarto-dev/quarto-cli/issues/12307)): Tabsets using `tabby.js` in non-boostrap html (`theme: pandoc`, `theme: none` or `minimal: true`) now correctly render reactive content when `server: shiny` is used.
- ([#12356](https://github.com/quarto-dev/quarto-cli/issues/12356)): Remove duplicate id in HTML document when using `#lst-` prefix label for using Quarto crossref.

## `pdf` format

Expand All @@ -72,6 +73,7 @@ All changes included in 1.7:
- ([#11676](https://github.com/quarto-dev/quarto-cli/pull/11676)): Convert unitless image widths from pixels to inches for column layouts.
- ([#11835](https://github.com/quarto-dev/quarto-cli/issues/11835)): Take markdown structure into account when detecting minimum heading level.
- ([#11964](https://github.com/quarto-dev/quarto-cli/issues/11964)): Using panel layout without a crossref label now correctly do not add an empty `#block[]` that was leading to an unnecessary space in output.
- ([#12354](https://github.com/quarto-dev/quarto-cli/issues/12354)): CodeBlock in Listing with `#lst-` prefix are now correctly highlighted.

## Interactive Shiny Document

Expand Down
25 changes: 0 additions & 25 deletions src/resources/filters/customnodes/floatreftarget.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,6 @@ end, function(float)
float.content.caption.long = float.caption_long
float.content.attr = pandoc.Attr(float.identifier, float.classes or {}, float.attributes or {})
return float.content
elseif float_type == "lst" then
local handle_code_block = function(codeblock)
codeblock.attr = merge_attrs(codeblock.attr, pandoc.Attr("", float.classes or {}, float.attributes or {}))
return codeblock
end
if float.content.t == "CodeBlock" then
float.content = handle_code_block(float.content)
else
float.content = _quarto.ast.walk(float.content, {
CodeBlock = handle_code_block
})
end
end

local fig_scap = attribute(float, kFigScap, nil)
Expand Down Expand Up @@ -630,19 +618,6 @@ _quarto.ast.add_renderer("FloatRefTarget", function(_)
return _quarto.format.isHtmlOutput()
end, function(float)
decorate_caption_with_crossref(float)

------------------------------------------------------------------------------------
-- Special handling for listings
local found_listing = get_node_from_float_and_type(float, "CodeBlock")
if found_listing then
found_listing.attr = merge_attrs(found_listing.attr, pandoc.Attr("", float.classes or {}, float.attributes or {}))
-- FIXME this seems to be necessary for our postprocessor to kick in
-- check this out later
found_listing.identifier = float.identifier
end

------------------------------------------------------------------------------------

return float_reftarget_render_html_figure(float)
end)

Expand Down
6 changes: 3 additions & 3 deletions src/resources/filters/quarto-pre/parsefiguredivs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,8 @@ function parse_floatreftargets()
end
code.attr.attributes['lst-cap'] = nil

local attr = code.attr
-- code.attr = pandoc.Attr("", {}, {})
local attr = pandoc.Attr(code.identifier, code.attr.classes, code.attr.attributes)
code.attr = pandoc.Attr("", code.classes, code.attr.attributes)
return construct({
attr = attr,
type = "Listing",
Expand Down Expand Up @@ -686,7 +686,7 @@ function parse_floatreftargets()
end

local attr = code.attr
code.attr = pandoc.Attr("", {}, {})
code.attr = pandoc.Attr("", code.classes, code.attr.attributes)
return construct({
attr = attr,
type = "Listing",
Expand Down
20 changes: 20 additions & 0 deletions tests/docs/smoke-all/2025/03/25/issue-12354.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
format:
typst: default
html: default
_quarto:
tests:
html:
ensureHtmlElements:
- ['div#lst-1.listing', 'div#lst-2.listing']
- ['div#lst-1.sourceCode', 'div#lst-2.sourceCode']
---

```{#lst-1 .r filename="asdfoasdf.R" lst-cap="A listing." my-key="value"}
print("Hello, world!")
```


```{#lst-2 .r lst-cap="A listing." my-key="value"}
print("Hello, world!")
```
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _quarto:
tests:
latex:
ensureFileRegexMatches:
- []
- [Shaded]
- []
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ _quarto:
typst:
ensureTypstFileRegexMatches:
-
- "#ref\\(<lst-customers>, supplement: \\[Listing\\]\\)"
- "Customers Query"
- '#figure\(\[\s+#set align\(left\)'
- '```sql\s+SELECT \* FROM Customers\s+```'
- '#ref\(<lst-customers>, supplement: \[Listing\]\)'
- 'Customers Query'
- []
---

Expand Down
26 changes: 26 additions & 0 deletions tests/docs/smoke-all/crossrefs/float/typst/typst-listings-2.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Listings Test
format: typst
keep-typ: true
_quarto:
tests:
typst:
ensureTypstFileRegexMatches:
-
- '#figure\(\[\s+#set align\(left\)'
- '```sql\s+SELECT \* FROM Customers\s+```'
- '#ref\(<lst-customers>, supplement: \[Listing\]\)'
- 'Customers Query'
- []
---

::: {#lst-customers}

```{.sql}
SELECT * FROM Customers
```
Customers Query

:::

Then we query the customers database (@lst-customers).