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.4.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- ([#6714](https://github.com/quarto-dev/quarto-cli/issues/6714)): Display title block for HTML when other (non-title/author/subtitle) metadata is present.
- ([#6833](https://github.com/quarto-dev/quarto-cli/issues/6833)): Handle partially-specified aspect ratio, width, and height attributes in `video` shortcode.
- ([#7137](https://github.com/quarto-dev/quarto-cli/discussions/7137)): Automatically set `rel="noopener"` when setting a target on external links
- ([#7187](https://github.com/quarto-dev/quarto-cli/issues/7187)): Add `html-table-processing: none` to document- and project-level metadata to disable HTML table processing. Add `{html-table-processing="none"}` to a fenced div to disable HTML table processing for the elements in that div.

## Appendix

Expand Down
5 changes: 5 additions & 0 deletions src/command/render/filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
kFormatIdentifier,
kHeaderIncludes,
kHtmlMathMethod,
kHtmlTableProcessing,
kIncludeAfter,
kIncludeAfterBody,
kIncludeBefore,
Expand Down Expand Up @@ -553,6 +554,10 @@ async function quartoFilterParams(
if (foldCode) {
params[kCodeFold] = foldCode;
}
const htmlTableProcessing = format.render[kHtmlTableProcessing];
if (htmlTableProcessing) {
params[kHtmlTableProcessing] = htmlTableProcessing;
}
const tblColwidths = format.render[kTblColwidths];
if (tblColwidths !== undefined) {
params[kTblColwidths] = tblColwidths;
Expand Down
3 changes: 3 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export const kQuartoRequired = "quarto-required";
export const kPreviewMode = "preview-mode";
export const kPreviewModeRaw = "raw";

export const kHtmlTableProcessing = "html-table-processing";

export const kIdentifierDefaultsKeys = [
kTargetFormat,
kDisplayName,
Expand Down Expand Up @@ -214,6 +216,7 @@ export const kRenderDefaultsKeys = [
kNotebookViewStyle,
kNotebookPreserveCells,
kClearCellOptions,
kHtmlTableProcessing,
];

// language fields
Expand Down
2 changes: 2 additions & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import {
kGladtex,
kHighlightStyle,
kHtmlMathMethod,
kHtmlTableProcessing,
kInclude,
kIncludeAfterBody,
kIncludeBeforeBody,
Expand Down Expand Up @@ -471,6 +472,7 @@ export interface FormatRender {
[kNotebookPreserveCells]?: boolean;
[kClearCellOptions]?: boolean;
[kIpynbProduceSourceNotebook]?: boolean;
[kHtmlTableProcessing]?: "none";
}

export interface FormatExecute {
Expand Down
20 changes: 15 additions & 5 deletions src/resources/editor/tools/vs-code.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16200,6 +16200,15 @@ var require_yaml_intelligence_resources = __commonJS({
short: "Specify the default dpi (dots per inch) value for conversion from pixels to inch/\ncentimeters and vice versa.\n",
long: "Specify the default dpi (dots per inch) value for conversion from pixels to inch/\ncentimeters and vice versa. (Technically, the correct term would be ppi: pixels per\ninch.) The default is `96`. When images contain information about dpi internally, the\nencoded value is used instead of the default specified by this option.\n"
}
},
{
name: "html-table-processing",
schema: {
enum: [
"none"
]
},
description: "If `none`, do not process tables in HTML input."
}
],
"schema/document-reveal-content.yml": [
Expand Down Expand Up @@ -21019,7 +21028,7 @@ var require_yaml_intelligence_resources = __commonJS({
"Keep the markdown file generated by executing code",
"Keep the notebook file generated from executing code.",
"Filters to pre-process ipynb files before rendering to markdown",
"Speicfy which nodes should be run interactively (displaying output\nfrom expressions)",
"Specify which nodes should be run interactively (displaying output\nfrom expressions)",
"Keep the intermediate typst file used during render.",
"Keep the intermediate tex file used during render.",
{
Expand Down Expand Up @@ -21908,7 +21917,8 @@ var require_yaml_intelligence_resources = __commonJS({
},
"Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).",
"Manuscript configuration",
"internal-schema-hack"
"internal-schema-hack",
"If <code>none</code>, do not process tables in HTML input."
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -22132,12 +22142,12 @@ var require_yaml_intelligence_resources = __commonJS({
mermaid: "%%"
},
"handlers/mermaid/schema.yml": {
_internalId: 168151,
_internalId: 168154,
type: "object",
description: "be an object",
properties: {
"mermaid-format": {
_internalId: 168143,
_internalId: 168146,
type: "enum",
enum: [
"png",
Expand All @@ -22153,7 +22163,7 @@ var require_yaml_intelligence_resources = __commonJS({
exhaustiveCompletions: true
},
theme: {
_internalId: 168150,
_internalId: 168153,
type: "anyOf",
anyOf: [
{
Expand Down
20 changes: 15 additions & 5 deletions src/resources/editor/tools/yaml/web-worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 15 additions & 5 deletions src/resources/editor/tools/yaml/yaml-intelligence-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -9172,6 +9172,15 @@
"short": "Specify the default dpi (dots per inch) value for conversion from pixels to inch/\ncentimeters and vice versa.\n",
"long": "Specify the default dpi (dots per inch) value for conversion from pixels to inch/\ncentimeters and vice versa. (Technically, the correct term would be ppi: pixels per\ninch.) The default is `96`. When images contain information about dpi internally, the\nencoded value is used instead of the default specified by this option.\n"
}
},
{
"name": "html-table-processing",
"schema": {
"enum": [
"none"
]
},
"description": "If `none`, do not process tables in HTML input."
}
],
"schema/document-reveal-content.yml": [
Expand Down Expand Up @@ -13991,7 +14000,7 @@
"Keep the markdown file generated by executing code",
"Keep the notebook file generated from executing code.",
"Filters to pre-process ipynb files before rendering to markdown",
"Speicfy which nodes should be run interactively (displaying output\nfrom expressions)",
"Specify which nodes should be run interactively (displaying output\nfrom expressions)",
"Keep the intermediate typst file used during render.",
"Keep the intermediate tex file used during render.",
{
Expand Down Expand Up @@ -14880,7 +14889,8 @@
},
"Disambiguating year suffix in author-date styles (e.g.&nbsp;“a” in “Doe,\n1999a”).",
"Manuscript configuration",
"internal-schema-hack"
"internal-schema-hack",
"If <code>none</code>, do not process tables in HTML input."
],
"schema/external-schemas.yml": [
{
Expand Down Expand Up @@ -15104,12 +15114,12 @@
"mermaid": "%%"
},
"handlers/mermaid/schema.yml": {
"_internalId": 168151,
"_internalId": 168154,
"type": "object",
"description": "be an object",
"properties": {
"mermaid-format": {
"_internalId": 168143,
"_internalId": 168146,
"type": "enum",
"enum": [
"png",
Expand All @@ -15125,7 +15135,7 @@
"exhaustiveCompletions": true
},
"theme": {
"_internalId": 168150,
"_internalId": 168153,
"type": "anyOf",
"anyOf": [
{
Expand Down
4 changes: 3 additions & 1 deletion src/resources/filters/modules/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ local kIncludeInHeader = "include-in-header"

local kCopyright = "copyright"
local kLicense = "license"
local kHtmlTableProcessing = "html-table-processing"

-- for a given language, the comment character(s)
local kLangCommentChars = {
Expand Down Expand Up @@ -187,5 +188,6 @@ return {
kCopyright = kCopyright,
kLicense = kLicense,

kLangCommentChars = kLangCommentChars
kLangCommentChars = kLangCommentChars,
kHtmlTableProcessing = kHtmlTableProcessing
}
7 changes: 5 additions & 2 deletions src/resources/filters/normalize/astpipeline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
function quarto_ast_pipeline()
return {
{ name = "normalize-table-merge-raw-html", filter = table_merge_raw_html() },


-- this can't be combined because it's top-down processing.
-- unfortunate.
{ name = "normalize-html-table-processing", filter = parse_html_tables() },

{ name = "normalize-combined-1", filter = combineFilters({
parse_html_tables(),
parse_extended_nodes(),
code_filename(),
normalize_fixup_data_uri_image_extension(),
Expand Down
9 changes: 9 additions & 0 deletions src/resources/filters/normalize/parsehtml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ end

function parse_html_tables()
local filter
if param(constants.kHtmlTableProcessing) == "none" then
return {}
end
filter = {
traverse = "topdown",
Div = function(div)
if div.attributes[constants.kHtmlTableProcessing] == "none" then
return div.contents, false
end
end,
RawBlock = function(el)
if _quarto.format.isRawHtml(el) then
-- if we have a raw html table in a format that doesn't handle raw_html
Expand Down
5 changes: 5 additions & 0 deletions src/resources/schema/document-render.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,8 @@
centimeters and vice versa. (Technically, the correct term would be ppi: pixels per
inch.) The default is `96`. When images contain information about dpi internally, the
encoded value is used instead of the default specified by this option.

- name: html-table-processing
schema:
enum: [none]
description: If `none`, do not process tables in HTML input.
20 changes: 20 additions & 0 deletions tests/docs/smoke-all/2023/10/10/issue-7187-b.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: issue-7187
_quarto:
tests:
html:
ensureHtmlElements:
- []
- ["table.table"]
---

::: {html-table-processing="none"}

```{=html}
<table>
<thead><tr><th>header</th></tr></thead>
<tbody><tr><td>body</td></tr></tbody>
</table>
```

:::
18 changes: 18 additions & 0 deletions tests/docs/smoke-all/2023/10/10/issue-7187.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: issue-7187
html-table-processing: none
_quarto:
tests:
html:
ensureHtmlElements:
- []
- ["table.table"]
---


```{=html}
<table>
<thead><tr><th>header</th></tr></thead>
<tbody><tr><td>body</td></tr></tbody>
</table>
```