Skip to content

fix: preserve blog section headings and code comments - #1375

Merged
tannerlinsley merged 2 commits into
mainfrom
taren/preserve-blog-headings
Oct 13, 2026
Merged

tannerlinsley merged 2 commits into
mainfrom
taren/preserve-blog-headings

Conversation

@tannerlinsley

@tannerlinsley tannerlinsley commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

The title cleanup in #1370 removes the first line beginning with # anywhere in an article. This deletes Form v1's installation heading and comments inside five other articles' code examples.

Parse the original Markdown, then remove only a leading H1 from the document and table of contents. Skip editorial HTML comments, preserve visible HTML, and retain later heading anchors.

Validation: four focused regression tests cover fenced code, later headings, editorial comments, visible HTML and duplicate heading anchors. All six affected article ASTs are preserved. Earlier local browser checks confirmed Form's heading and TOC link and Query's code comment. Both equivalent production builds passed; the article chunk grows 220 raw bytes / 114 gzip bytes. An 81-article microbenchmark showed no obvious slowdown, not a runtime guarantee. This small measured cost fixes lost article content without adding a dependency.

Full pnpm test passed before rebasing the fix onto current main. CI will validate the rebased head.

Summary by CodeRabbit

  • Bug Fixes
    • Improved blog post title handling when content begins with HTML comments, preserving subsequent headings and their links.
    • Visible HTML before a heading is now handled correctly when determining whether to omit a leading title.

@changeset-bot

changeset-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 11466ec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 98a56d7a-45da-4c51-9217-9d62549ba9bb
📥 Commits

Reviewing files that changed from the base of the PR and between 7c96ea3 and 11466ec.

📒 Files selected for processing (3)
  • src/routes/blog.$.tsx
  • src/utils/blogMarkdown.ts
  • tests/blog-markdown.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The blog route now parses full post content with parseBlogMarkdown. The parser removes a leading H1 and its matching heading metadata after skipping HTML blocks that contain only whitespace-separated comments.

Changes: Blog Markdown parsing

Layer / File(s) Summary
Parser behavior and route integration
src/utils/blogMarkdown.ts, src/routes/blog.$.tsx, tests/blog-markdown.test.ts
Adds parseBlogMarkdown and uses it to parse full blog content. Tests cover leading-title removal, comment and visible HTML handling, and heading anchors.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 11466

The change has no identified merge-blocking risk; it is ready for normal checks.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving blog section headings and code comments during Markdown parsing.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • 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

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
tanstack-com 11466ec Oct 13 2026, 05:25 PM

@tannerlinsley
tannerlinsley merged commit de92ae2 into main Oct 13, 2026
8 checks passed
@tannerlinsley
tannerlinsley deleted the taren/preserve-blog-headings branch October 13, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant