fix(site): Handle indenting better - #595
Conversation
|
Seems fine |
There was a problem hiding this comment.
🟡 Changes recommended
The new indentation normalizer can outdent nested ordered-list content (e.g., multi-digit markers like 13.), which can break CommonMark/GitHub list nesting and alter rendered document structure.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the static-site generator’s Markdown preprocessing to better normalize nested list indentation for Python-Markdown rendering, and adjusts list indentation in the confidential MPT XLS to match the intended nesting.
Changes:
- Add
normalize_list_indentation()inscripts/build_site.pyand apply it before Markdown-to-HTML conversion. - Fix nested list indentation in
XLS-0096-confidential-mpt/README.mdunder the “Compact Send sigma proof” section.
File summaries
| File | Description |
|---|---|
XLS-0096-confidential-mpt/README.md |
Adjusts nested bullet indentation so the list renders with the intended hierarchy. |
scripts/build_site.py |
Introduces list-indentation normalization to reduce rendering differences between GitHub/CommonMark and Python-Markdown. |
Review details
Suppressed comments (1)
scripts/build_site.py:115
- Continuation lines are also potentially outdented when the parent list item’s content column is > 4*(depth+1) (e.g., multi-digit ordered list markers with extra spacing). Outdenting can move content left of the required CommonMark content column and change list structure in GitHub-rendered Markdown.
shift = 4 * (stack[-1][2] + 1) - stack[-1][1] if stack else 0
out.append(_shift(line, shift))
- Files reviewed: 1/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| stack.pop() | ||
| depth = len(stack) | ||
| stack.append((indent, item_match.end(), depth)) | ||
| out.append(_shift(line, 4 * depth - indent)) |
There was a problem hiding this comment.
Added a defensive clamp in a36cc55 so both the marker shift and the continuation shift never move a line below its parent's content column. Wide ordered markers (e.g. 100. ) now keep their nested children at the original indent instead of being outdented.
Never outdent a list marker or its continuations below the parent's content column. This preserves CommonMark nesting for the edge case where an ordered marker (`100.`, etc.) is wider than one tab stop.
High Level Overview of Change
Context of Change
Type of Change