Skip to content

PRDCT-347: per-page raw markdown + LLM actions dropdown#1009

Merged
jordanrburger merged 2 commits into
mainfrom
feat/PRDCT-347-md-llm-actions
Jul 20, 2026
Merged

PRDCT-347: per-page raw markdown + LLM actions dropdown#1009
jordanrburger merged 2 commits into
mainfrom
feat/PRDCT-347-md-llm-actions

Conversation

@Iamfle4ka

Copy link
Copy Markdown
Collaborator

Closes PRDCT-347.

What this adds

1. Every docs page is now also published as raw markdown at <page>/index.md (e.g. help.keboola.com/storage/index.md) — new src/integrations/page-markdown.mjs (modeled on redirect-from.mjs, astro:build:done): strips frontmatter, prepends # <title>, skips the 404 page, never clobbers existing files. 257 pages emitted.

2. The "Copy as Markdown" button becomes a split-button with a chevron menu:

  • View as Markdown → opens <page>/index.md
  • Open in ChatGPTchatgpt.com/?hints=search&q=<"Read <md url> so I can ask questions about it">
  • Open in Claudeclaude.ai/new?q=<same prompt>

Links recompute on every astro:page-load/astro:after-swap (view-transition-safe); listeners bind once behind the existing dataset.bound guard. Menu items are <a> elements so the structural .page-title-row > :last-child button rule doesn't restyle them; new styles are in custom.css only (selectors at 0-3-0 specificity to beat that structural rule — see inline comment).

Verification (local production build)

  • Build clean; [page-markdown] Emitted 257 raw-markdown pages (0 skipped).
  • dist/storage/index.md starts with # Storage, no frontmatter leak; homepage dist/index.md OK; nested slugs OK; no dist/404/index.md.
  • Exactly one group/menu per page; copy button regression-checked (same initCopyBtn path).
  • astro preview: GET /storage/index.md200 text/markdown; page HTML still 200.
  • node scripts/audit-phase2.mjs: 111 issues, all pre-existing (Jekyll link smells etc.), zero related to this change.

Notes

  • In npm run dev the index.md files don't exist (emitted at build time, like Pagefind) — View as Markdown 404s in dev only.
  • Production content-type depends on the S3 sync mime mapping for .md; if it serves as octet-stream we may want --content-type text/markdown for *.md in the deploy step (follow-up if needed).
  • Groundwork for the on-hold llms.txt work (PRDCT-383).

🤖 Generated with Claude Code

Emit every docs page as raw markdown at <slug>/index.md (new page-markdown
integration, modeled on redirect-from.mjs: strips frontmatter, prepends
"# <title>", skips 404, never clobbers). Extend the "Copy as Markdown" button
into a split-button with a menu: View as Markdown, Open in ChatGPT, Open in
Claude — links recomputed on every astro:page-load/after-swap navigation.

Menu styles live in custom.css; selectors bumped to 0-3-0 to beat the
structural `.page-title-row > :last-child button` rule. Menu items are <a>
elements so that rule doesn't restyle them.

Verified: build clean; 257 index.md emitted (404 skipped, homepage OK, nested
slugs OK, no frontmatter leak); one group/menu per page; preview serves
/storage/index.md as 200 text/markdown; audit-phase2 issues all pre-existing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 8, 2026

Copy link
Copy Markdown

PRDCT-347

@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)
connection-docs Ready Ready Preview, Comment Jul 20, 2026 3:51pm

Request Review

@jordanrburger

Copy link
Copy Markdown
Contributor

Review summary

Verdict: merge-ready with two optional nits.

Solid, low-risk feature. The build-time integration mirrors redirect-from.mjs (astro:build:done, non-clobbering, skips 404). Verified all 258 content files are .md with explicit slugs and there are 0 .mdx files, so every page gets an index.md (257, matching the log) — no broken-link risk for "View as Markdown". URLs are correct for trailingSlash: 'always', and menu links are recomputed on every navigation.

Nits (optional):

  • CopyMarkdown.astro (initActionsMenu): the two document-level listeners (click, keydown) are guarded only by the swapped element's dataset.bound. Since CopyMarkdown renders in PageTitle.astro (recreated each navigation, not transition:persist), the guard resets every view transition and a new pair of document listeners is added per navigation — a genuine accumulation. Impact is low (stale handlers act on detached nodes), but bind the document-level listeners once via a module-scoped flag.
  • Base .copy-md-btn styles remain in the component's existing <style> block while the new split-button/menu styles are in custom.css, so button styling is split across two files. Pre-existing, flagging only for consistency.

Note for maintainer: deploy is aws s3 sync dist with no per-extension content-type mapping. If S3 serves .md as application/octet-stream, "View as Markdown" will download rather than render inline in the browser (LLM fetches are unaffected). Worth confirming the S3 mime mapping or adding --content-type text/markdown for *.md.

Automated review pass (Claude Code), flagged for a human maintainer — not an approval.

@jordanrburger jordanrburger left a comment

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.

Approved. Smoke-tested on the Vercel preview: dropdown opens/closes, View/Copy as Markdown work, Open-in-ChatGPT/Claude links resolve, and the actions survive client-side navigation. Two optional follow-ups noted in the review comment (document-listener leak on view transitions; confirm S3 serves .md as text/markdown so 'View as Markdown' renders rather than downloads) — neither blocks merge.

@jordanrburger
jordanrburger enabled auto-merge July 20, 2026 15:47
@jordanrburger
jordanrburger merged commit 9adf94e into main Jul 20, 2026
2 of 3 checks passed
@jordanrburger
jordanrburger deleted the feat/PRDCT-347-md-llm-actions branch July 20, 2026 15:51
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.

2 participants