Skip to content

[blog-renderer-table-fence-fix] fix broken markdown tables/fences, add tracked template downloads - #124

Merged
Smetools merged 1 commit into
mainfrom
hassan/blog-renderer-table-fence-fix
Jul 8, 2026
Merged

[blog-renderer-table-fence-fix] fix broken markdown tables/fences, add tracked template downloads#124
Smetools merged 1 commit into
mainfrom
hassan/blog-renderer-table-fence-fix

Conversation

@Smetools

@Smetools Smetools commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Bug found + fixed

app/lib/blog.ts's hand-rolled markdown renderer had zero support for GFM tables (| a | b |) or fenced code blocks (```). Either one silently collapsed into a single run-on paragraph with literal |/``` characters left in the text.

Confirmed live-broken on namuthaj-mahdar-ijtimaa-ar — the site's only post earning non-brand organic clicks. Its copy-paste template section shipped as garbled text (verified against the live page before this PR).

Fixed both:

  • Fenced code blocks -> <pre><code> (verbatim, not reflowed)
  • GFM tables -> real <table>

Verified via a real next build: the same post's static page now regenerates the template section as a proper <pre> block, byte-identical source content, no stray markers. tsc --noEmit clean.

New capability: tracked template downloads

Per Hassan: any "copy-paste template" a post promises should ship as a real downloadable file, not inline prose, and downloads should be tracked.

  • template_download_href / template_download_label frontmatter -> BlogPostMeta.templateDownload
  • New TemplateDownload component (app/components/blog/template-download.tsx), rendered after the article -- tracks posthog.capture('template_download', {slug, href, format}) + gtag on click
  • scripts/gen-template-docx.py -- reusable generator (python-docx) that turns a plain-text template into a real .docx, for future template-download posts

First consumer: PR #113 (how-to-do-meeting-minutes), which now ships app/public/downloads/meeting-minutes-template.docx instead of an inline fence.

Notes

  • No content changes -- pure infra/bug-fix, satellite-repo auto-merge policy applies (build/tsc green, no security-touching diff).
  • Media generation separately confirmed to already be Google Gemini end-to-end (gen-image.py -> gemini-3.1-flash-image-preview) -- no code change needed there, locked in as a standing rule in the blogger routine's STEERING.md instead.

🤖 Generated with Claude Code

…te downloads

The hand-rolled markdown renderer (app/lib/blog.ts) had no support for
```-fenced code blocks or `| a | b |` tables — either one silently
mangled into unreadable run-on prose (whitespace collapsed, literal
```/| characters left in the text). Confirmed LIVE-BROKEN on
namuthaj-mahdar-ijtimaa-ar (the site's only non-brand-click-earning
post) — its template section shipped as garbled text. Verified fixed
via a real `next build`: the same post now statically renders a proper
<pre><code> block, byte-for-byte the same source content.

Also adds the capability for posts to ship a real downloadable asset
(e.g. a copy-paste template as .docx) instead of relying on an inline
code fence: `template_download_href`/`template_download_label`
frontmatter -> new TemplateDownload component, tracked via
posthog.capture('template_download', ...) + gtag on click. First
consumer is the how-to-do-meeting-minutes draft (PR #113).

Verified: tsc --noEmit clean, `next build` succeeds (blog/[slug]
statically regenerates namuthaj-mahdar-ijtimaa-ar correctly).
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
knowcap-landing Ready Ready Preview, Comment Jul 8, 2026 11:38am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Smetools, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 01113979-230d-45cb-ae64-a0a8c59301f9

📥 Commits

Reviewing files that changed from the base of the PR and between 853560f and d757775.

📒 Files selected for processing (5)
  • app/app/blog/[slug]/page.tsx
  • app/app/blog/blog-styles.ts
  • app/components/blog/template-download.tsx
  • app/lib/blog.ts
  • scripts/gen-template-docx.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hassan/blog-renderer-table-fence-fix

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.

@Smetools
Smetools merged commit eaf2611 into main Jul 8, 2026
3 checks passed
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