Skip to content

Commit 0e175fb

Browse files
committed
revealjs - Prevent unexpected Pandoc syntax list in blockquote to become incremental list
This means we don't support on purpose a Pandoc syntax documented in their doc (https://pandoc.org/MANUAL.html#incremental-lists) but it is really unexpected behavior and their is other means to create incremental list which are documented
1 parent 885239e commit 0e175fb

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

news/changelog-1.6.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All changes included in 1.6:
1515
## `revealjs` Format
1616

1717
- Update to Reveal JS 5.1.0.
18+
- ([#7715](https://github.com/quarto-dev/quarto-cli/issues/7715)): Revealjs don't support anymore special Pandoc syntax making BulletList in Blockquotes become incremental list. This was confusing and unexpected behavior. Supported syntax for incremental list is documented at <https://quarto.org/docs/presentations/revealjs/#incremental-lists>.
1819

1920
## `typst` Format
2021

src/format/reveal/format-reveal.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,27 @@ function revealHtmlPostprocessor(
834834
supporting: [],
835835
};
836836

837+
// Remove blockquote scaffolding added in Lua post-render to prevent Pandoc syntax for applying
838+
if (doc.querySelectorAll("div.blockquote-list-scaffold")) {
839+
const blockquoteListScaffolds = doc.querySelectorAll(
840+
"div.blockquote-list-scaffold",
841+
);
842+
for (const blockquoteListScaffold of blockquoteListScaffolds) {
843+
const blockquoteListScaffoldEL = blockquoteListScaffold as Element;
844+
const blockquoteListScaffoldParent =
845+
blockquoteListScaffoldEL.parentNode;
846+
if (blockquoteListScaffoldParent) {
847+
while (blockquoteListScaffoldEL.firstChild) {
848+
blockquoteListScaffoldParent.insertBefore(
849+
blockquoteListScaffoldEL.firstChild,
850+
blockquoteListScaffoldEL,
851+
);
852+
}
853+
blockquoteListScaffoldParent.removeChild(blockquoteListScaffoldEL);
854+
}
855+
}
856+
}
857+
837858
// apply highlighting mode to body
838859
doc.body.classList.add("quarto-" + highlightingMode);
839860

src/resources/filters/main.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ local quarto_post_filters = {
392392
{ name = "post-render-gfm-fixups", filter = render_gfm_fixups() },
393393
{ name = "post-render-hugo-fixups", filter = render_hugo_fixups() },
394394
{ name = "post-render-email", filters = render_email() },
395-
{ name = "post-render-pptx-fixups", filter = render_pptx_fixups() }
395+
{ name = "post-render-pptx-fixups", filter = render_pptx_fixups() },
396+
{ name = "post-render-revealjs-fixups", filter = render_reveal_fixups() }
396397
}
397398

398399
local quarto_finalize_filters = {

src/resources/filters/quarto-post/reveal.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,20 @@ function asCssSize(size)
5151
else
5252
return size
5353
end
54+
end
55+
56+
function render_reveal_fixups()
57+
if not _quarto.format.isRevealJsOutput() then
58+
return {}
59+
end
60+
return {
61+
-- Prevent BulletList in blockquote to be made incremental with .fragment class
62+
-- https://github.com/quarto-dev/quarto-cli/issues/7715
63+
BlockQuote = function(b)
64+
if #b.content and b.content[1].t == "BulletList" then
65+
b.content = pandoc.Div(b.content, pandoc.Attr('', {'blockquote-list-scaffold'}))
66+
return b
67+
end
68+
end
69+
}
5470
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: BulletList in Blockquote should not be fragment
3+
format: revealjs
4+
_quarto:
5+
tests:
6+
revealjs:
7+
ensureHtmlElements:
8+
- ['blockquote > ul > li:not([class])']
9+
- ['blockquote > ul > li.fragment', 'div.blockquote-list-scaffold']
10+
---
11+
12+
## Blockquote and incremental
13+
14+
> * Foo
15+
> * Bar
16+
17+
Using blockquote should not create incremental like Pandoc (https://pandoc.org/MANUAL.html#incremental-lists)

0 commit comments

Comments
 (0)