Skip to content

Strip the smallest common indent from schema-row descriptions - #1799

Merged
NajiObeid merged 3 commits into
mainfrom
sromani/uhu-3499-the-markdown-build-keeps-the-nesting-of-schema-rows-with-any
Nov 4, 2026
Merged

NajiObeid merged 3 commits into
mainfrom
sromani/uhu-3499-the-markdown-build-keeps-the-nesting-of-schema-rows-with-any

Conversation

@shadromani

Copy link
Copy Markdown
Contributor

Fixes UHU-3499: https://linear.app/maxmind/issue/UHU-3499/the-markdown-build-keeps-the-nesting-of-schema-rows-with-any-indent

layouts/partials/markdown/schema-row.md removed exactly two leading spaces from each line of a field description. A row with a different indent lost its list nesting, or became a code block, and Hugo showed no error.

  • The partial now finds the smallest indent of the non-blank lines and removes that amount. Blank lines stay blank. A description with no indent is unchanged.

Verified with a full build: the output is identical to main. A row indented by four spaces with a nested list keeps its nesting. Lint passes.

Follow-up to the review of #1771.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 27, 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: 6cff66ca-5b53-400a-9a08-39a561395092
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying dev-site with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7ff8360
Status: ✅  Deploy successful!
Preview URL: https://cb6b1253.dev-site-4ua.pages.dev
Branch Preview URL: https://sromani-uhu-3499-the-markdow.dev-site-4ua.pages.dev

View logs

@shadromani
shadromani force-pushed the sromani/uhu-3499-the-markdown-build-keeps-the-nesting-of-schema-rows-with-any branch from cb38227 to a228f18 Compare November 2, 2026 18:07
Comment thread layouts/partials/markdown/schema-row.md Outdated
Comment on lines +19 to +28
{{- if findRE `(?m)^ *\t` .inner 1 -}}
{{- errorf "%s: field %q: tabs are not allowed in schema-row indents" .page.File.Path .key -}}
{{- end -}}
{{- $head := replaceRE `(?s)\n.*` "" .inner -}}
{{- $body := strings.TrimPrefix $head .inner -}}
{{- $indent := -1 -}}
{{- range findRE `(?m)^ *\S` $body -}}
{{- $n := sub (len .) (len (strings.TrimLeft " " .)) -}}
{{- if or (lt $indent 0) (lt $n $indent) }}{{ $indent = $n }}{{ end -}}
{{- 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.

this can also catch tabs in code blocks.

claude suggests this fix.

Suggested change
{{- if findRE `(?m)^ *\t` .inner 1 -}}
{{- errorf "%s: field %q: tabs are not allowed in schema-row indents" .page.File.Path .key -}}
{{- end -}}
{{- $head := replaceRE `(?s)\n.*` "" .inner -}}
{{- $body := strings.TrimPrefix $head .inner -}}
{{- $indent := -1 -}}
{{- range findRE `(?m)^ *\S` $body -}}
{{- $n := sub (len .) (len (strings.TrimLeft " " .)) -}}
{{- if or (lt $indent 0) (lt $n $indent) }}{{ $indent = $n }}{{ end -}}
{{- end -}}
{{- $head := replaceRE `(?s)\n.*` "" .inner -}}
{{- $body := strings.TrimPrefix $head .inner -}}
{{- $indent := -1 -}}
{{- range findRE `(?m)^ *\S` $body -}}
{{- $n := sub (len .) (len (strings.TrimLeft " " .)) -}}
{{- if or (lt $indent 0) (lt $n $indent) }}{{ $indent = $n }}{{ end -}}
{{- end -}}
{{- $tab := cond (lt $indent 0) `(?m)^ *\t` (printf `(?m)^ {0,%d}\t` (sub $indent 1)) -}}
{{- if and (ne $indent 0) (findRE $tab $body 1) -}}
{{- errorf "%s: field %q: tabs are not allowed in schema-row indents" .page.File.Path .key -}}
{{- en

shadromani and others added 3 commits November 3, 2026 19:24
The Markdown schema-row partial removed exactly two leading spaces from
each line of a field description. That is correct only while every row
uses a two-space base indent. A row with a different indent lost its
list nesting, or became an indented code block, and Hugo gave no error.

Find the smallest space indent of the description lines with text and
remove that amount. Text on the opening-tag line has no indent, so the
partial does not measure or strip that line. All current rows use a
two-space or no indent, so the site output does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The schema-row partial counts only spaces when it finds the common
indent. A description line indented with a tab keeps its tab, so Hugo
renders it as a code block and gives no error.

Stop the build when an indent holds a tab. The error names the page and
the field, so both schema-row shortcodes pass the page to the partial.
No current row uses a tab, so the site output does not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tab check ran on the full content, so a tab inside a code block
stopped the build. Check for tabs only in the part of the indent that
the template strips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shadromani
shadromani force-pushed the sromani/uhu-3499-the-markdown-build-keeps-the-nesting-of-schema-rows-with-any branch from a228f18 to 7ff8360 Compare November 3, 2026 19:26
@NajiObeid
NajiObeid merged commit dee3ff4 into main Nov 4, 2026
11 checks passed
@NajiObeid
NajiObeid deleted the sromani/uhu-3499-the-markdown-build-keeps-the-nesting-of-schema-rows-with-any branch November 4, 2026 02:40
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