Skip to content

Markdown pages have no runs of blank lines - #1797

Open
shadromani wants to merge 3 commits into
mainfrom
sromani/uhu-3498-markdown-pages-have-no-runs-of-blank-lines
Open

shadromani wants to merge 3 commits into
mainfrom
sromani/uhu-3498-markdown-pages-have-no-runs-of-blank-lines

Conversation

@shadromani

Copy link
Copy Markdown
Contributor

Fixes UHU-3498: https://linear.app/maxmind/issue/UHU-3498/markdown-pages-have-no-runs-of-blank-lines

The Markdown output had runs of 2 or more blank lines after shortcodes such as alerts. They do not change the rendered page, but they add tokens. llms-full.txt had about 385 such runs.

  • layouts/partials/markdown/body.md collapses runs of blank lines to one, outside fenced code blocks. Every Markdown page passes through this partial, so one fix covers every shortcode. Blank lines inside code fences do not change.
  • layouts/_default/list.md no longer writes a blank line before the section page list when that list is empty.

Verified with a full build: runs outside code fences went from 400 (46 files) to 0. llms-full.txt is 576 lines shorter. The HTML output is unchanged. Lint passes.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 09027ef2-2ed7-4fa1-b4be-1f1eb33657ef
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Deploying dev-site with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8a387de
Status: ✅  Deploy successful!
Preview URL: https://7e073482.dev-site-4ua.pages.dev
Branch Preview URL: https://sromani-uhu-3498-markdown-pa.dev-site-4ua.pages.dev

View logs

Comment thread layouts/_default/list.md Outdated
Comment on lines +12 to +16
{{- /* One blank line between the body and the list, and no blank lines at
the end when every child is already linked. */ -}}
{{- with $unlinked }}
{{ with $body }}
{{ end -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things here:

  • Section pages with all their children linked now end without a newline. There are 14 pages like that, for example, minfraud/track-devices/index.md.
  • If a section has no body, we get two blank lines between the title and "Pages in this section". No occurrences I could find right now in the codebase though.

This should fix both:

Suggested change
{{- /* One blank line between the body and the list, and no blank lines at
the end when every child is already linked. */ -}}
{{- with $unlinked }}
{{ with $body }}
{{ end -}}
{{- /* End the body with a newline, and add a blank line before the list.
A page with no body needs neither. */ -}}
{{- if $body }}
{{ end -}}
{{- with $unlinked }}
{{- if $body }}
{{ end -}}

shadromani and others added 3 commits October 27, 2026 20:37
Shortcodes and the newlines around them in the source leave runs of two
to five blank lines in the Markdown output. One blank line separates
blocks just as well and costs fewer tokens. The body partial now swaps
each fenced code block for a placeholder, collapses the runs, and swaps
the code back, so blank lines inside samples stay as they are.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A section page whose body already links every child ended with two
blank lines, because the blank line before "Pages in this section" was
written even when that list was left out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A section page whose body already links every child ended without a
newline, because the newline after the body was written only with the
list. The list template now ends the body with a newline on its own and
adds the blank line before the list only when there is a body and a
list, so a section page ends the way a single page does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@shadromani
shadromani force-pushed the sromani/uhu-3498-markdown-pages-have-no-runs-of-blank-lines branch from 73e08da to 8a387de Compare October 27, 2026 20:38
@shadromani
shadromani requested a review from NajiObeid October 27, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants