Widen the prettier gate to markdown and CSS everywhere (closes #12)
All checks were successful
check / check (push) Successful in 59s
All checks were successful
check / check (push) Successful in 59s
REPO_POLICIES.md scopes prettier to JS/CSS/Markdown/HTML, but script/fmt
and script/fmt-check covered only '*.md' - top-level markdown. The
canonical scripts use '**/*.md'. Both now run over '**/*.md' and
'**/*.css', and both header comments, which still described the old
top-level-only scope, were rewritten.
That brings themes/loravega/static/css/style.css into the gate. It is
inlined into every page by baseof.html via readFile, and its formatting
is whitespace-only: the minified <style> block in the built
public/index.html is byte-identical across the reformat, which is the
preceding commit.
Two paths are excluded, each with the reason recorded in
.prettierignore so the exclusion reads as a decision rather than an
oversight:
themes/loravega/layouts/ - these are not HTML. They are Go templates
carrying {{ define }}, {{ block }}, {{ .Content }} and
{{ readFile ... | safeCSS }}, and prettier has no Go-template parser; it
would fail or reflow the delimiters into markup Hugo cannot parse.
Covering them needs an out-of-tree plugin and therefore a package.json,
which this repo deliberately does not have.
content/ - excluded on measurement, not on the earlier assumption. With
content/ in scope, prettier re-wrapped one list item in
content/_index.md, and the rendered public/index.html changed with it:
the wrap landed as a literal newline between "7 PM at" and the following
<a> tag. HTML collapses that newline to a space, so the page looks the
same, but the published bytes do not match, and this content carries raw
div/span/br blocks that goldmark passes through verbatim because
hugo.toml sets markup.goldmark.renderer.unsafe = true. A formatter that
can silently change a published page is not worth the consistency.
archetypes/ stays covered - it is a template for new content, not
published output, and prettier leaves it unchanged.
Verified by extracting public/ from the built image before and after.
With the final scope, index.html, index.xml and sitemap.xml are
byte-identical; only the verbatim-copied public/css/style.css differs,
in whitespace. Each commit on this branch passes make check on its own -
the reformat lands first, under the old narrow glob that does not look
at CSS, so the widening commit arrives on an already-clean tree and no
merge commit is required to land it.
This commit is contained in:
19
TODO.md
19
TODO.md
@@ -28,6 +28,25 @@ remaining policy scaffold is otherwise complete.
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-08-09: widened the prettier gate from top-level markdown to `'**/*.md'`
|
||||
and `'**/*.css'` (closes #12). `themes/loravega/static/css/style.css` was
|
||||
never formatted or gated even though it is inlined into every page; it is now
|
||||
both, and the reformat landed as its own commit ahead of the script change so
|
||||
no commit in the branch is red. `content/` is excluded in `.prettierignore`,
|
||||
and that exclusion is measured rather than assumed: with `content/` in scope,
|
||||
prettier re-wrapped one list item in `content/_index.md` and the rendered
|
||||
`public/index.html` changed with it (the wrap became a literal newline between
|
||||
`7 PM at` and the following `<a>`). HTML collapses that newline to a space so
|
||||
the page looks identical, but the published bytes are not, and this content
|
||||
carries raw HTML that goldmark passes through verbatim under `unsafe = true`.
|
||||
`themes/loravega/layouts/` is excluded too, with the reason recorded: those
|
||||
files are Go templates, not HTML, and prettier has no parser for `{{ ... }}` —
|
||||
covering them would need a plugin and therefore a `package.json`. Verified by
|
||||
extracting `public/` from the built image before and after: with the final
|
||||
scope, `index.html`, `index.xml` and `sitemap.xml` are byte-identical and only
|
||||
the verbatim-copied `public/css/style.css` changes, in whitespace only — the
|
||||
minified `<style>` block inlined into `index.html` is unchanged, which is the
|
||||
direct evidence that CSS formatting cannot reach the rendered page
|
||||
- 2026-08-09: added the canonical policy dotfiles and hardened both ignore files
|
||||
(closes #8). `REPO_POLICIES.md` is a byte-identical copy of the canonical
|
||||
`prompts` file, front matter intact; `.editorconfig`, `.prettierrc` and
|
||||
|
||||
Reference in New Issue
Block a user