Skip to content

docs(website): serve Markdown source at .md URLs - #701

Merged
benvinegar merged 1 commit into
mainfrom
claude/hunk-docs-dot-md-endpoints
Aug 10, 2026
Merged

docs(website): serve Markdown source at .md URLs#701
benvinegar merged 1 commit into
mainfrom
claude/hunk-docs-dot-md-endpoints

Conversation

@benvinegar

@benvinegar benvinegar commented Aug 9, 2026

Copy link
Copy Markdown
Member

Follows #700 (merged). Rebased onto main, so the diff here is just the .md endpoints.

What

Adds starlight-dot-md. Every docs page's Markdown source is now served at the same URL plus .md:

/docs/start/install/     -> HTML page
/docs/start/install.md   -> Markdown source

29 doc pages, one line of config.

Why this and not just llms.txt

They cover different access patterns. The corpus files are for learning Hunk — an agent pulls ~32k tokens once and knows the tool. This is for reading one page when an agent already knows Hunk and someone pastes it a link.

The concrete win is fidelity, not discovery. HTML→Markdown conversion is lossy in exactly the places that hurt a CLI tool, and #700 demonstrated it: Starlight's heading anchors serialized into 170 Section titled "…"](#…) artifacts that needed a CSS selector to strip. Source served as source has none of that.

Worth being clear on the limit, since it shapes how much this is worth: agents generally don't probe for .md. I don't — I fetch the URL I'm given. This pays off when the pattern is advertised (an AGENTS.md rule, or a link that already ends in .md), not merely because the route exists.

Reviewer notes

Verified no collateral damage:

  • Sitemap stays canonical-only — 30 entries, zero .md. No duplicate-content pollution.
  • public/docs/hunk-review-skill.md is not shadowed — the hand-authored skill file still serves intact. Asserted in the test, since a silent shadow would be easy to miss.
  • website:links, astro check, oxlint all clean.

Known wart: docs/index.mdx serves raw MDX, so /docs.md includes its import statement and 8 <CardGrid>/<LinkCard> tags rather than prose. It's the only .mdx page in the docs; the card attributes stay readable enough for an LLM to parse the nav intent; and llms-full.txt already renders that page as clean prose because it converts from rendered HTML. Converting the page to .md would cost the card grid for human readers — the worse trade, so I left it.

Minor: frontmatter is Starlight's resolved schema (template: doc, pagefind: true, …) rather than the author's source frontmatter. ~8 lines per page, no config option to trim it, not worth caring about.

Testing

Full website suite 38/38 passing. New test asserts the .md route returns raw source (not HTML with a .md suffix), preserves fenced code blocks, that the HTML companion still renders, and that the skill file isn't shadowed.

Empty changeset — website-only, no effect on the published hunkdiff package.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hunk-web Ready Ready Preview Aug 10, 2026 2:42am

Request Review

@socket-security

socket-security Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedstarlight-dot-md@​0.2.1721007788100

View full report

@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds starlight-dot-md so each Starlight documentation page is available as Markdown at its corresponding .md URL.

  • Registers the plugin in the website’s Astro configuration and adds its locked dependency.
  • Adds smoke coverage for raw Markdown output, fenced code blocks, the companion HTML route, and preservation of the hand-authored review-skill asset.
  • Adds an empty website-only changeset.

Confidence Score: 4/5

The PR appears safe to merge, with only a non-blocking source-formatting inconsistency to address.

The Markdown endpoint integration, dependency resolution, and tested static-file collision have no identified behavioral defect; the sole accepted concern is that newly added code conflicts with the repository’s required indentation and quote style.

Files Needing Attention: website/astro.config.mjs, website/tests/docs-smoke.spec.ts

Important Files Changed

Filename Overview
website/astro.config.mjs Registers the Markdown-source plugin correctly, with a minor repository formatting-rule violation.
website/package.json Adds the compatible starlight-dot-md dependency.
website/bun.lock Locks the plugin and preserves incompatible YAML consumers through scoped resolutions.
website/tests/docs-smoke.spec.ts Covers the primary Markdown route and static-asset collision, but the added code violates the repository formatting directive.
.changeset/brave-moons-tap.md Records the website-only change without requesting a package release.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Source[Starlight docs source] --> Plugin[starlight-dot-md]
  Plugin --> Markdown["/docs/path.md"]
  Source --> Starlight[Starlight renderer]
  Starlight --> HTML["/docs/path/"]
  Public["public/docs/hunk-review-skill.md"] --> Static["/docs/hunk-review-skill.md"]
Loading
Prompt To Fix All With AI
### Issue 1
website/astro.config.mjs:5
**Inconsistent source formatting**

The new import and the test added in `website/tests/docs-smoke.spec.ts` use double-quoted strings and two-space indentation instead of the repository-required single quotes and four-space indentation, introducing inconsistent formatting and avoidable formatter churn.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "docs(website): serve Markdown source at ..." | Re-trigger Greptile

Comment thread website/astro.config.mjs
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";
import starlight from "@astrojs/starlight";
import starlightDotMd from "starlight-dot-md";

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.

P2 Inconsistent source formatting

The new import and the test added in website/tests/docs-smoke.spec.ts use double-quoted strings and two-space indentation instead of the repository-required single quotes and four-space indentation, introducing inconsistent formatting and avoidable formatter churn.

Context Used: guidelines.mdc Cursor rule (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: website/astro.config.mjs
Line: 5

Comment:
**Inconsistent source formatting**

The new import and the test added in `website/tests/docs-smoke.spec.ts` use double-quoted strings and two-space indentation instead of the repository-required single quotes and four-space indentation, introducing inconsistent formatting and avoidable formatter churn.

**Context Used:** guidelines.mdc Cursor rule ([source](https://github.com/modem-dev/modem/blob/main/.cursor/rules/guidelines.mdc))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the reply on #700 — declining, the rule appears to come from a different repository.

guidelines.mdc is in modem-dev/modem; modem-dev/hunk has no .cursor directory and doesn't inherit it.

Formatting here is enforced by oxfmt at default settings — 2-space indent, double quotes. oxfmt --check reports both changed files already conform, and .lintstagedrc.json runs oxfmt --write pre-commit, so the "avoidable formatter churn" this flags would actually be introduced by making the suggested change, not avoided by it.

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.

You're right, my mistake. The guidelines.mdc rule belongs to modem-dev/modem and I incorrectly applied it here. Given that oxfmt --check confirms the current formatting is correct for this repo, the suggestion was backwards — the change I proposed would have introduced a violation, not fixed one.

I attempted to deactivate the guidelines.mdc rule for this repo but the action was blocked. You may want to remove or scope that custom instruction manually at https://app.greptile.com/review/custom-instructions to prevent it from firing on modem-dev/hunk PRs in the future.

A hunk.dev docs link pasted into an agent currently resolves to HTML that
has to be converted back to Markdown, which is lossy in exactly the places
that matter for a CLI tool. The llms.txt corpus added alongside this covers
the "learn Hunk" case; this covers reading a single page.

Add starlight-dot-md so every docs page's source is available at the same
URL plus `.md` (/docs/start/install.md). Sitemap stays canonical-only, so
no duplicate-content pollution, and the hand-authored skill file served
from public/ is not shadowed.

Known wart: docs/index.mdx serves raw MDX, so /docs.md includes its import
statement and <CardGrid>/<LinkCard> tags. It is the only .mdx page, the
attributes stay readable, and llms-full.txt already renders that page as
plain prose. Converting it to .md would cost the card grid for humans,
which is the worse trade.
@benvinegar
benvinegar force-pushed the claude/hunk-docs-dot-md-endpoints branch from 7a222ba to decfbbd Compare August 10, 2026 02:41
@benvinegar
benvinegar changed the base branch from claude/hunk-docs-llms-txt-1b48c9 to main August 10, 2026 02:41
@benvinegar
benvinegar merged commit 19bf705 into main Aug 10, 2026
12 of 20 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