Skip to content

Commit bff4e40

Browse files
authored
Merge pull request #13155 from quarto-dev/feature/pandoc-reader
lua,rawblock - recognize and process pandoc-reader:LANG blocks
2 parents ebe36ab + e7c71e4 commit bff4e40

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

news/changelog-1.8.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,8 @@ All changes included in 1.8:
130130
- ([#12782](https://github.com/quarto-dev/quarto-cli/pull/12782)): fix bug on `safeRemoveDirSync`'s detection of safe directory boundaries.
131131
- ([#12853](https://github.com/quarto-dev/quarto-cli/issues/12853)): fix replaceAll() escaping issue with embedded notebooks containing `$` in their Markdown.
132132
- ([#12939](https://github.com/quarto-dev/quarto-cli/pull/12939)): Upgrade `mermaidjs` to 11.6.0.
133-
- ([#13164](https://github.com/quarto-dev/quarto-cli/pull/13164)): add `julia` to execute schema to allow autocomplete suggestions. (@mcanouil)
133+
- ([#13164](https://github.com/quarto-dev/quarto-cli/pull/13164)): add `julia` to execute schema to allow autocomplete suggestions. (@mcanouil)
134+
135+
## Quarto Internals
136+
137+
- ([#13155](https://github.com/quarto-dev/quarto-cli/pull/13155)): Process `pandoc-reader-FORMAT` raw blocks through `pandoc.read(FORMAT)`

src/resources/filters/normalize/extractquartodom.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ function parse_md_in_html_rawblocks()
2828
end,
2929
RawBlock = function(raw)
3030
local result
31-
if raw.format == "pandoc-native" then
31+
if raw.format:sub(1, 14) == "pandoc-reader-" then
32+
-- this is a pandoc reader format, so we can read it directly
33+
result = pandoc.read(raw.text, raw.format:sub(15)).blocks
34+
elseif raw.format == "pandoc-native" then
3235
result = pandoc.read(raw.text, "native").blocks
3336
elseif raw.format == "pandoc-json" then
3437
result = pandoc.read(raw.text, "json").blocks
@@ -39,7 +42,10 @@ function parse_md_in_html_rawblocks()
3942
end,
4043
RawInline = function(raw)
4144
local result
42-
if raw.format == "pandoc-native" then
45+
if raw.format:sub(1, 14) == "pandoc-reader-" then
46+
-- this is a pandoc reader format, so we can read it directly
47+
result = quarto.utils.as_inlines(pandoc.read(raw.text, raw.format:sub(15)).blocks)
48+
elseif raw.format == "pandoc-native" then
4349
result = quarto.utils.as_inlines(pandoc.read(raw.text, "native").blocks)
4450
elseif raw.format == "pandoc-json" then
4551
-- let's try to be minimally smart here, and handle lists differently from a single top-level element
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
format: html
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
- - table
8+
- em
9+
---
10+
11+
```{=pandoc-reader-markdown}
12+
+-------+--------+
13+
| col1 | col2 |
14+
+-------+--------+
15+
| row | value |
16+
+-------+--------+
17+
```
18+
19+
```{=pandoc-reader-latex}
20+
\emph{emphasis}
21+
```

0 commit comments

Comments
 (0)