Skip to content

fix: code blocks within tabbed content blocks are double spaced#1510

Open
rafaumeu wants to merge 1 commit into
mattermost:masterfrom
rafaumeu:fix/code-blocks-double-spacing-1303
Open

fix: code blocks within tabbed content blocks are double spaced#1510
rafaumeu wants to merge 1 commit into
mattermost:masterfrom
rafaumeu:fix/code-blocks-double-spacing-1303

Conversation

@rafaumeu

Copy link
Copy Markdown

Summary

Fixes #1303

Code blocks within tabbed content blocks were being double-spaced. The root cause was in the tab Hugo shortcode (site/layouts/shortcodes/tab.html), where {{ .Inner | markdownify }} did not trim surrounding whitespace. Hugo's template engine inserts the inner content with leading/trailing newlines, which markdownify then converts into extra <br>/paragraph breaks inside code blocks.

Fix

Changed {{ .Inner | markdownify }} to {{- .Inner | markdownify -}} using Hugo's whitespace trimming delimiters ({{- and -}}), which removes the surrounding newlines before markdown processing.

@mattermost-build

Copy link
Copy Markdown
Contributor

Hello @rafaumeu,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2b0bc7d-3ad8-4930-ac51-ac009cb35dbf

📥 Commits

Reviewing files that changed from the base of the PR and between 078f70f and 62df966.

📒 Files selected for processing (1)
  • site/layouts/shortcodes/tab.html

📝 Walkthrough

Walkthrough

The tab.html shortcode template is updated to use Hugo's whitespace-trimming delimiters ({{- and -}}) when rendering .Inner through markdownify, replacing the previous non-trimming form. This removes surrounding whitespace from the rendered Markdown output.

Changes

Tab Shortcode Whitespace Fix

Layer / File(s) Summary
Tab shortcode whitespace-trimming delimiter update
site/layouts/shortcodes/tab.html
Replaces {{ markdownify .Inner }} with {{- markdownify .Inner -}}, trimming surrounding whitespace from the rendered Markdown content within tab blocks.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing double-spaced code blocks in tabbed content by modifying the tab shortcode.
Description check ✅ Passed The description is directly related to the changeset, clearly explaining the root cause and the fix applied to the tab.html shortcode.
Linked Issues check ✅ Passed The PR fully addresses the objectives from issue #1303 by fixing the double-spacing problem in code blocks within tabbed content through whitespace trimming.
Out of Scope Changes check ✅ Passed The change is strictly scoped to fixing the identified issue; only the tab.html shortcode was modified with no extraneous alterations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mattermost-build

Copy link
Copy Markdown
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Help Wanted: Code blocks within tabbed content blocks are being double spaced

2 participants