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
4 changes: 4 additions & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ All changes included in 1.8:

- ([#12775](https://github.com/quarto-dev/quarto-cli/issues/12775)): Convert Quarto-native layouts (divs with `layout` syntax) to Beamer columns, equivalent to using the Pandoc-native syntax of div with `columns` and `column` classes.

### `hugo-md`

- ([#12676](https://github.com/quarto-dev/quarto-cli/issues/12676)): Add support for rendering layout panels that are not floats.

## Projects

### `website`
Expand Down
86 changes: 46 additions & 40 deletions src/resources/filters/layout/hugo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,61 @@
_quarto.ast.add_renderer("PanelLayout", function(_)
return _quarto.format.isHugoMarkdownOutput()
end, function(layout)
local function make_panel_content()
local panel_content = pandoc.Blocks({})
-- layout
for i, row in ipairs(layout.layout) do

local aligns = row:map(function(cell)
-- get the align
local align = cell.attributes[kLayoutAlign]
return layoutTableAlign(align)
end)
local widths = row:map(function(cell)
-- propagage percents if they are provided
local layoutPercent = horizontalLayoutPercent(cell)
if layoutPercent then
return layoutPercent / 100
else
return 0
end
end)

local cells = pandoc.List()
for _, cell in ipairs(row) do
cells:insert(cell)
end

-- make the table
local panelTable = pandoc.SimpleTable(
pandoc.List(), -- caption
aligns,
widths,
pandoc.List(), -- headers
pandoc.List { cells }
)

-- add it to the panel
panel_content:insert(pandoc.utils.from_simple_table(panelTable))
end
return panel_content
end

if layout.float == nil then
fail_and_ask_for_bug_report("Can't render layouts without floats")
return pandoc.Div({})
-- if there is no float, then we just return the content and preamble
local result = pandoc.Div(layout.preamble or {})
result.content:extend(make_panel_content())
return result
end
decorate_caption_with_crossref(layout.float)

-- empty options by default
if not options then
options = {}
end
-- outer panel to contain css and figure panel
local attr = pandoc.Attr(layout.identifier or "", layout.classes or {}, layout.attributes or {})
local panel_content = pandoc.Blocks({})
-- layout
for i, row in ipairs(layout.layout) do

local aligns = row:map(function(cell)
-- get the align
local align = cell.attributes[kLayoutAlign]
return layoutTableAlign(align)
end)
local widths = row:map(function(cell)
-- propagage percents if they are provided
local layoutPercent = horizontalLayoutPercent(cell)
if layoutPercent then
return layoutPercent / 100
else
return 0
end
end)

local cells = pandoc.List()
for _, cell in ipairs(row) do
cells:insert(cell)
end

-- make the table
local panelTable = pandoc.SimpleTable(
pandoc.List(), -- caption
aligns,
widths,
pandoc.List(), -- headers
{ cells }
)

-- add it to the panel
panel_content:insert(pandoc.utils.from_simple_table(panelTable))
end
local panel_content = make_panel_content()

-- outer panel to contain css and figure panel
local result = pandoc.Div({})
-- the format for the rawblock is html and not markdown_strict
-- because this might end up inside a table, and Pandoc
Expand Down
12 changes: 12 additions & 0 deletions tests/docs/smoke-all/2025/06/12/issue-12676.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
format: hugo-md
---

::: {layout-ncol="2"}

Hello.

Hello.

:::

Loading