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
3 changes: 2 additions & 1 deletion news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ All changes included in 1.8:
- ([#12727](https://github.com/quarto-dev/quarto-cli/issues/12727)): Do not crash in the presence of malformed tabset contents.
- ([#12806](https://github.com/quarto-dev/quarto-cli/pull/12806)): Use pandoc APIs to handle codepage conversion on Windows.
- ([#12811](https://github.com/quarto-dev/quarto-cli/pull/12811)): Add support for YouTube Shorts in `video` shortcode.
- ([#13128](https://github.com/quarto-dev/quarto-cli/issues/13128)): Meta shortcode could crash on bad input.
- ([#13112](https://github.com/quarto-dev/quarto-cli/pull/13112)): Add `quarto.format.format_identifier()` API entry.
- ([#13128](https://github.com/quarto-dev/quarto-cli/issues/13128)): Avoid meta shortcode crash on bad input.
- ([#13246](https://github.com/quarto-dev/quarto-cli/pull/13246)): Add `quarto.variables.get()` and `quarto.metadata.get()` APIs.

## Commands
Expand Down
11 changes: 10 additions & 1 deletion src/resources/lua-types/quarto/format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,13 @@ Returns an object with the format name and variants as would be interpreted by P
]]
---@param raw_format string The format's string
---@return quarto.format.ParseFormatResult
function quarto.format.parse_format(raw_format) end
function quarto.format.parse_format(raw_format) end

--[[
Returns a table with the format identifier information, including:
- `target-format`: The full target format name, e.g. `html+variant`
- `base-format`: The base format name, e.g. `html`
- `display-name`: A human-readable display name for the format, e.g. `HTML`
- `extension`: The name of the extension that exposes the format, if present
]]
function quarto.format.format_identifier() end
3 changes: 3 additions & 0 deletions src/resources/pandoc/datadir/_format.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ local function _main()
end

return {
format_identifier = function()
return param("format-identifier", {})
end,
isAsciiDocOutput = isAsciiDocOutput,
is_asciidoc_output = isAsciiDocOutput,
isRawHtml = isRawHtml,
Expand Down
7 changes: 7 additions & 0 deletions tests/docs/smoke-all/lua/format/format-identifier.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function Pandoc(doc)
local identifier = quarto.format.format_identifier()
assert(identifier["target-format"] == "html+test")
assert(identifier["base-format"] == "html")
assert(identifier["display-name"] == "HTML")
return doc
end
6 changes: 6 additions & 0 deletions tests/docs/smoke-all/lua/format/format-identifier.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
format: html+test
filters:
- format-identifier.lua
---

Loading