Skip to content

Allow multi-line code snippets in Markdown tables - #310

Open
adutra wants to merge 1 commit into
norwoodj:masterfrom
adutra:markdown-multiline
Open

Allow multi-line code snippets in Markdown tables#310
adutra wants to merge 1 commit into
norwoodj:masterfrom
adutra:markdown-multiline

Conversation

@adutra

@adutra adutra commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

This change enhances the chart.valueDefaultColumnRenderMd template which now uses multi-line code snippets with <pre> tags.

The default values are rendered with a new template: chart.valueDefaultColumnRenderInline. Any line breaks are replaced with <br/> since Markdown table cells cannot have line breaks.

HTML is properly escaped when default values are surrounded by backticks, e.g. `<span>foo</span>` is rendered as <pre>&lt;span&gt;foo&lt;/span&gt;</pre>, but <span>foo</span> is rendered as <pre><span>foo</span></pre> without escaping. This behavior matches the existing behavior for Markdown tables.

The "tpl" notation type is also supported.

The motivation for this change is that Markdown tables are generally better rendered by websites like Hugo than HTML tables, but single-line snippets often make the "Default" column too wide and the overall table layout becomes unbalanced.

@norwoodj

norwoodj commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Gotta resolve your merge conflicts

@adutra
adutra force-pushed the markdown-multiline branch from 1fd3ecd to c7097ad Compare March 5, 2026 08:58
@adutra

adutra commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

Gotta resolve your merge conflicts

Fixed, sorry about that.

@adutra

adutra commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

FYI there might be a small regression for people doing custom values with Markdown markup. For example:

# -- The foo value.
# @default -- Default is `bar` or `qix`.
foo: ~

Now this would have to be changed to:

# -- The foo value.
# @default -- Default is <code>bar</code> or <code>qix</code>.
foo: ~

This change enhances the `chart.valueDefaultColumnRenderMd` template which now uses multi-line code snippets with `<pre>` tags.

The default values are rendered with a new template: `chart.valueDefaultColumnRenderInline`. Any line breaks are replaced with `<br/>` since Markdown table cells cannot have line breaks.

HTML is properly escaped when default values are surrounded by backticks, e.g. `` `<span>foo</span>` `` is rendered as `<pre>&lt;span&gt;foo&lt;/span&gt;</pre>`, but `<span>foo</span>` is rendered as `<pre><span>foo</span></pre>` without escaping. This behavior matches the existing behavior for Markdown tables.

The "tpl" notation type is also supported.

The motivation for this change is that Markdown tables are generally better rendered by websites like Hugo than HTML tables, but single-line snippets often make the "Default" column too wide and the overall table layout becomes unbalanced.
@adutra
adutra force-pushed the markdown-multiline branch from c7097ad to 2396a87 Compare March 5, 2026 09:24
@adutra

adutra commented Apr 2, 2026

Copy link
Copy Markdown
Contributor Author

@norwoodj would you have some time soon to have a look? Thanks! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants