Skip to content

Add code callouts attribute and replace code-callout shortcodes#7069

Merged
sanderson merged 4 commits intomasterfrom
code-callouts
Apr 8, 2026
Merged

Add code callouts attribute and replace code-callout shortcodes#7069
sanderson merged 4 commits intomasterfrom
code-callouts

Conversation

@sanderson
Copy link
Copy Markdown
Collaborator

Summary

  • Adds callout and callout-color attributes on codeblocks to replace code-callout shortcodes. The attribute approach is much less brittle than the shortcode approach.
  • Replaces all existing code-callout shortcode usage.
  • Removes the code-callout shortcode
  • Updates repo documentation to include information about using the callout attribute
  • Fixes bug in the inluxdb/host shortcode that was adding a newline when rendering the output.

Checklist

  • Rebased/mergeable
  • Local build passes (npx hugo --quiet)

sanderson and others added 3 commits April 6, 2026 15:47
Support highlighting code in code blocks via fence attributes instead of
the code-callout shortcode. Defaults to green when callout-color is omitted.
Works alongside placeholders on the same code block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Document the new callout and callout-color code fence attributes as the
preferred approach. Move the shortcode syntax to a backward-compatibility
note.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sanderson sanderson requested a review from a team as a code owner April 6, 2026 23:05
@sanderson sanderson requested review from jstirnaman and removed request for a team April 6, 2026 23:05
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

Vale Style Check Results

Metric Count
Errors 3
Warnings 54
Suggestions 74

Errors (blocking)

File Line Rule Message
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 330 Vale.Repetition 'table' is repeated!
content/influxdb3/clustered/query-data/execute-queries/client-libraries/python.md 321 Vale.Repetition 'table' is repeated!
content/influxdb3/cloud-dedicated/query-data/execute-queries/client-libraries/python.md 328 Vale.Repetition 'table' is repeated!
Warnings (54)
File Line Rule Message
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 40 Cloud-Serverless.Branding Did you mean 'bucket' instead of 'database'
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 43 Cloud-Serverless.Branding Did you mean 'measurement' instead of 'table'
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 44 Cloud-Serverless.Branding Did you mean 'measurement' instead of 'table'
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 45 Google.Quotes Commas and periods go inside quotation marks.
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 49 Cloud-Serverless.Branding Did you mean 'measurement' instead of 'table'
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 50 Cloud-Serverless.Branding Did you mean 'measurement' instead of 'table'
content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md 330 write-good.Illusions 'table' is repeated!
content/influxdb3/clustered/query-data/execute-queries/client-libraries/python.md 38 Google.Quotes Commas and periods go inside quotation marks.
content/influxdb3/clustered/query-data/execute-queries/client-libraries/python.md 321 write-good.Illusions 'table' is repeated!
content/influxdb3/cloud-dedicated/query-data/execute-queries/client-libraries/python.md 44 Google.Quotes Commas and periods go inside quotation marks.
content/influxdb3/cloud-dedicated/query-data/execute-queries/client-libraries/python.md 328 write-good.Illusions 'table' is repeated!
DOCS-SHORTCODES.md 61 write-good.Passive 'is required' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 168 write-good.Passive 'is changed' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 173 write-good.Passive 'are limited' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 173 write-good.Passive 'be closed' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 175 write-good.TooWordy 'indicate' is too wordy.
DOCS-SHORTCODES.md 175 write-good.Passive 'be processed' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 180 write-good.Passive 'is used' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 180 write-good.Passive 'be closed' may be passive voice. Use active voice if you can.
DOCS-SHORTCODES.md 182 write-good.TooWordy 'indicate' is too wordy.

Showing first 20 of 54 warnings.


Check failed — fix 3 error(s) before merging.

@github-actions github-actions bot added product:explorer InfluxDB 3 Explorer product:shared Shared content across products product:telegraf Telegraf documentation product:v1 InfluxDB v1 OSS product:v2 InfluxDB v2 (Cloud TSM, OSS) product:v2-cloud InfluxDB Cloud (TSM) product:v3-distributed InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered product:v3-monolith InfluxDB 3 Core and Enterprise (single-node / clusterable) labels Apr 6, 2026
@sanderson sanderson removed product:v2-cloud InfluxDB Cloud (TSM) product:v3-monolith InfluxDB 3 Core and Enterprise (single-node / clusterable) product:v3-distributed InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered product:v2 InfluxDB v2 (Cloud TSM, OSS) product:v1 InfluxDB v1 OSS product:telegraf Telegraf documentation product:explorer InfluxDB 3 Explorer product:shared Shared content across products labels Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

PR Preview Action v1.4.8
🚀 Deployed preview to https://influxdata.github.io/docs-v2/pr-preview/pr-7069/
on branch gh-pages at 2026-04-07 20:51 UTC

@github-actions github-actions bot added product:explorer InfluxDB 3 Explorer product:shared Shared content across products product:telegraf Telegraf documentation product:v1 InfluxDB v1 OSS product:v2 InfluxDB v2 (Cloud TSM, OSS) labels Apr 7, 2026
@github-actions github-actions bot added product:v2-cloud InfluxDB Cloud (TSM) product:v3-distributed InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered product:v3-monolith InfluxDB 3 Core and Enterprise (single-node / clusterable) labels Apr 7, 2026
@sanderson sanderson merged commit d80eb2f into master Apr 8, 2026
13 of 15 checks passed
@sanderson sanderson deleted the code-callouts branch April 8, 2026 15:19
github-actions bot added a commit that referenced this pull request Apr 8, 2026
jstirnaman pushed a commit that referenced this pull request Apr 9, 2026
… branch

Commit d80eb2f (#7069) refactored `layouts/_default/_markup/render-codeblock.html`
to support the new `callout` fence attribute alongside the existing
`placeholders` attribute. The refactor introduced a new conditional
branch that handles placeholder/callout code blocks, but several of its
interior action tags use bare `{{ ... }}` delimiters instead of the
whitespace-trimming `{{- ... -}}` form used in the `else` branch:

    {{- if or .Attributes.placeholders .Attributes.callout -}}
      {{ $code := highlight .Inner .Type }}
      ...
      {{ $code | safeHTML }}

Each non-trimmed action leaks two leading spaces and a trailing newline
into the render-hook output. For a placeholder code block the final
render-hook output then looks like:

    [2 spaces][newline]
    [4 spaces][newline]
    [4 spaces][newline]
    [2 spaces]<div class="highlight">...</div>[newline]

Goldmark sees this as an indented code block preceded by blank lines,
wraps the leading highlighted HTML in `<pre><code>`, and HTML-escapes
every `<` and `>`. The visible symptom is a wall of escaped
`<span class="line">...` fragments on every page with a placeholder or
callout code block, including every InfluxDB 3 sample-data page, the
enterprise backup-restore page, the clustered users/add page, and
about 18 other admin pages. The regression landed on Apr 8 with #7069
and was reported as #7079.

Fix: apply `{{- ... -}}` whitespace trimming to every action inside the
placeholder/callout branch, matching the pattern the `else` branch
already uses. No content files change. Verified with a local Hugo 0.149
build — every previously affected page now renders with zero escaped
highlight blocks, and the site-wide count of pages containing
`&lt;div class=&quot;highlight` drops from 23 to 0.

Closes #7079
jstirnaman added a commit that referenced this pull request Apr 9, 2026
… branch (#7084)

Commit d80eb2f (#7069) refactored `layouts/_default/_markup/render-codeblock.html`
to support the new `callout` fence attribute alongside the existing
`placeholders` attribute. The refactor introduced a new conditional
branch that handles placeholder/callout code blocks, but several of its
interior action tags use bare `{{ ... }}` delimiters instead of the
whitespace-trimming `{{- ... -}}` form used in the `else` branch:

    {{- if or .Attributes.placeholders .Attributes.callout -}}
      {{ $code := highlight .Inner .Type }}
      ...
      {{ $code | safeHTML }}

Each non-trimmed action leaks two leading spaces and a trailing newline
into the render-hook output. For a placeholder code block the final
render-hook output then looks like:

    [2 spaces][newline]
    [4 spaces][newline]
    [4 spaces][newline]
    [2 spaces]<div class="highlight">...</div>[newline]

Goldmark sees this as an indented code block preceded by blank lines,
wraps the leading highlighted HTML in `<pre><code>`, and HTML-escapes
every `<` and `>`. The visible symptom is a wall of escaped
`<span class="line">...` fragments on every page with a placeholder or
callout code block, including every InfluxDB 3 sample-data page, the
enterprise backup-restore page, the clustered users/add page, and
about 18 other admin pages. The regression landed on Apr 8 with #7069
and was reported as #7079.

Fix: apply `{{- ... -}}` whitespace trimming to every action inside the
placeholder/callout branch, matching the pattern the `else` branch
already uses. No content files change. Verified with a local Hugo 0.149
build — every previously affected page now renders with zero escaped
highlight blocks, and the site-wide count of pages containing
`&lt;div class=&quot;highlight` drops from 23 to 0.

Closes #7079

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:explorer InfluxDB 3 Explorer product:shared Shared content across products product:telegraf Telegraf documentation product:v1 InfluxDB v1 OSS product:v2-cloud InfluxDB Cloud (TSM) product:v2 InfluxDB v2 (Cloud TSM, OSS) product:v3-distributed InfluxDB 3 Cloud Serverless, Cloud Dedicated, Clustered product:v3-monolith InfluxDB 3 Core and Enterprise (single-node / clusterable)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant