Skip to content

Commit e2b5aba

Browse files
committed
add quarto-disable-processing to table->markdown path
1 parent 9059473 commit e2b5aba

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/resources/filters/normalize/parsehtml.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
-- parsehtml.lua
2+
-- Copyright (C) 2020-2023 Posit Software, PBC
3+
4+
local kDisableProcessing = "quarto-disable-processing"
5+
16
function parse_html_tables()
27
return {
38
RawBlock = function(el)
@@ -8,6 +13,17 @@ function parse_html_tables()
813
if tableBegin then
914
local tableHtml = tableBegin .. "\n" .. tableBody .. "\n" .. tableEnd
1015
local tableDoc = pandoc.read(tableHtml, "html")
16+
local skip = false
17+
tableDoc:walk({
18+
Table = function(table)
19+
if table.attributes[kDisableProcessing] ~= nil then
20+
skip = true
21+
end
22+
end
23+
})
24+
if skip then
25+
return nil
26+
end
1127
return tableDoc.blocks
1228
end
1329
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
function Table(table)
2+
print("huh?")
3+
-- we don't want this to be ever called in our test
4+
crash_with_stack_trace()
5+
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: test-quarto-disable-processing
3+
filters:
4+
- test-quarto-disable-processing.lua
5+
---
6+
7+
```{=html}
8+
<table data-quarto-disable-processing="true">
9+
<tr>
10+
<td>Hello world</td>
11+
</tr>
12+
</table>
13+
```

0 commit comments

Comments
 (0)