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
1 change: 1 addition & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ All changes included in 1.8:
- ([#12747](https://github.com/quarto-dev/quarto-cli/issues/12747)): Ensure `th` elements are properly restored when Quarto's HTML table processing is happening.
- ([#12766](https://github.com/quarto-dev/quarto-cli/issues/12766)): Use consistent equation numbering display for `html-math-method` and `html-math-method.method` for MathJax and KaTeX (author: @mcanouil)
- ([#12797](https://github.com/quarto-dev/quarto-cli/issues/12797)): Allow light and dark brands to be specified in one file, by specializing colors with `light:` and `dark:`.
- ([#12919](https://github.com/quarto-dev/quarto-cli/issues/12919)): Ensure `kbd` shortcode output has hover tooltip.

### `revealjs`

Expand Down
11 changes: 9 additions & 2 deletions src/resources/extensions/quarto/kbd/kbd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ return {
stylesheets = { 'resources/kbd.css' }
})
local kwargs_strs = {}
local title_strs = {}
for k, v in pairs(kwargs) do
table.insert(kwargs_strs, string.format('data-%s="%s"', osname(k), pandoc.utils.stringify(v)))
table.insert(title_strs, osname(k) .. ': ' .. pandoc.utils.stringify(v))
end
table.sort(kwargs_strs) -- sort so that the output is deterministic
local kwargs_str = table.concat(kwargs_strs)
Expand All @@ -29,9 +31,14 @@ return {
default_arg_str = ""
else
default_arg_str = pandoc.utils.stringify(args[1])
table.insert(title_strs, default_arg_str)
end

return pandoc.RawInline('html', '<kbd aria-hidden="true" ' .. kwargs_str .. '>' .. default_arg_str .. '</kbd><span class="visually-hidden">' .. default_arg_str .. '</span>')
table.sort(title_strs) -- sort so that the output is deterministic
local title_str = table.concat(title_strs, ', ')
if title_str == "" then
title_str = default_arg_str
end
return pandoc.RawInline('html', '<kbd title="' .. title_str .. '" aria-hidden="true" ' .. kwargs_str .. '>' .. default_arg_str .. '</kbd><span class="visually-hidden">' .. default_arg_str .. '</span>')
elseif quarto.doc.isFormat("asciidoc") then
if args and #args == 1 then
-- https://docs.asciidoctor.org/asciidoc/latest/macros/keyboard-macro/
Expand Down
12 changes: 12 additions & 0 deletions tests/docs/smoke-all/2025/06/12/issue-12919.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
format: html
_quarto:
tests:
html:
ensureHtmlElements:
- ['kbd[title="Shift-K"]','kbd[title="linux: Shift-Ctrl-L, mac: Shift-Command-O, windows: Shift-Control-O"]']
---

{{< kbd mac=Shift-Command-O win=Shift-Control-O linux=Shift-Ctrl-L >}}

{{< kbd Shift-K >}}
Loading