Repository navigation
fix(hugo): render option-tabs buttons instead of escaping them (#1591) - #1597
Merged
Merged
Conversation
The option-tabs shortcode is invoked with percent delimiters
({{% option-tabs %}}), so Hugo re-processes its rendered output as
markdown. The template indented the <button> lines 4 spaces and emitted
blank lines between the wrapping <div>s (from {{ range }}/{{ end }} on
their own lines). Goldmark then closed the raw-HTML block at the blank
line and parsed the indented <button> lines as an indented code block,
escaping them into <pre><code><button...></code></pre>.
Symptom: the Free Tier / Production tab buttons on
tutorials/hana-cloud-mission-trial-3 showed as escaped HTML source
instead of clickable tabs.
Fix: whitespace-trim the control lines ({{- -}}) and de-indent the
<button> so the output stays a single un-indented HTML block that
Goldmark passes through verbatim. Adds a Hugo-render regression test
that fails on the old template and passes on the new one.
This was referenced Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1591
Problem
On tutorials that use
[OPTION BEGIN]blocks (e.g. hana-cloud-mission-trial-3), the tab buttons rendered as escaped HTML source text inside a<pre><code>block instead of as clickable tabs:The tab panels rendered fine — only the button bar was broken.
Root cause
scripts/parsers/options.tsemits the tab group as a percent-delimited shortcode ({{% option-tabs %}}). Percent delimiters tell Hugo to re-process the shortcode's rendered output as markdown. The template:<button>lines 4 spaces, and{{ range }}/{{ end }}on their own lines, producing blank lines inside the output.Goldmark closed the raw-HTML block at the first blank line, then parsed the 4-space-indented
<button>lines as an indented code block → escaped them.Fix
Whitespace-trim the control lines (
{{- -}}) and de-indent the<button>so the shortcode output is one contiguous, un-indented HTML block that Goldmark passes through verbatim. Panels are unaffected (they arrive via.Inner).Testing
test/unit/option-tabs-render.test.ts— spins up a throwaway Hugo site with the real shortcode templates and asserts the buttons render as real<button>elements, not escaped source. Verified it fails against the old template and passes against the fix.scripts/__tests__/options-hugo.test.tsstill green (20/20 with the new test).