Skip to content

docs: write down the code-block file-name convention - #4177

Merged
max-sixty merged 2 commits into
mainfrom
extending
Sep 17, 2026
Merged

max-sixty merged 2 commits into
mainfrom
extending

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Follow-on to #4173, which gave every config sample on the site a file-name tab but left the convention itself unwritten.

docs/CLAUDE.md owns the code-block rules a contributor reads before editing a page. It now carries the leading # <path> comment that Expressive Code lifts into the tab, the title="<path>" fallback for a language with no comment syntax, and the exclusions — a block showing values for one key, or a counter-example, stays untitled. It also records the USER_CONFIG_START / PROJECT_CONFIG_START exception and why it exists: every line in those regions is # -prefixed into dev/config.example.toml, so a path comment would double-comment and name the file it already is.

The one sample left untitled, the three command values under "Other tools" on the LLM commit page, now says what it is — "Any of these replaces the command line above" — so the missing tab reads as a distinction rather than an oversight.

This was written by Claude Code on behalf of max-sixty

`docs/CLAUDE.md` owns the code-block rules a contributor reads before editing a
page, and said nothing about naming the file a config sample belongs in. It now
carries the leading `# <path>` comment, the `title="<path>"` fallback for a
language with no comment syntax, and the `USER_CONFIG_START` /
`PROJECT_CONFIG_START` exception — those regions are `# `-prefixed wholesale into
`dev/config.example.toml`, where a path comment would double-comment.

The one sample that stays untitled, the `command` values under "Other tools" on
the LLM commit page, now says it is a list of alternatives rather than a file.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two points on the convention text, both in docs/CLAUDE.md.

The USER_CONFIG_START / PROJECT_CONFIG_START exception restates a rule the same file already carries under "Command-page generation": "Config examples between USER_CONFIG_START / USER_CONFIG_END and PROJECT_CONFIG_START / PROJECT_CONFIG_END also generate commented TOML files. Put prose before a code block instead of adding standalone TOML comment lines that would become double-commented." That paragraph already rules out the comment line a path would live on, so the new one re-derives the # -prefix mechanism about 75 lines from where the file states it, and a change to transform_config_source_to_toml acquires a second place it has to stay true. Root CLAUDE.md under Project Status asks to "Consolidate or remove existing prose and machinery before adding another explanation, mode, or special case". The inline suggestion keeps the exception where the convention's reader needs it without the second copy; folding the sentence into the earlier paragraph instead would do as well.

The title="<path>" fallback is scoped to "a language with no comment syntax". That describes the json title="~/.claude/settings.json" fence on the Claude Code page, but not the markdown title="CLAUDE.md" fence on tips & patterns: Markdown has <!-- … -->, and Expressive Code accepts <!-- as a file-name comment start with markdown/md/mdx as their own language group (getFileNameFromComment in @expressive-code/plugin-frames, pinned here at 0.44.2), so <!-- CLAUDE.md --> would be lifted into the tab. A contributor applying the rule literally would therefore "correct" that block and put a stray HTML comment into a fragment readers copy into their own CLAUDE.md. The inline suggestion widens the condition so it covers both existing uses.

Comment thread docs/CLAUDE.md Resolved
Comment thread docs/CLAUDE.md Resolved
The double-comment rule under "Command-page generation" already rules out the
comment line a path would need, so the exception cross-references it rather than
re-deriving the `# `-prefix mechanism.

`title="<path>"` is for a sample where the comment would be invalid or noisy,
not one whose language lacks comments: Expressive Code reads `<!--` as a
file-name comment for `markdown`, so the old wording invited a stray HTML
comment into a fragment readers paste into their own CLAUDE.md.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit d72d0a9 into main Sep 17, 2026
40 checks passed
@max-sixty
max-sixty deleted the extending branch September 17, 2026 22:59
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