fix: strip hidden Unicode (U+200B) from build output #6

Merged
alex merged 1 commit from pi/issue5-1784175204059 into master 2026-07-16 04:17:29 +00:00
Contributor

Summary

Fixes #5 — resolves the Renovate warning about hidden Unicode characters in the repository.

Root cause

Renovate flagged a hidden Unicode character in the repo. The only occurrence was a zero-width space (U+200B) in dist/index.html, inside a CSS rule that originates from the @picocss/pico framework:

:where(nav li):before{float:left;content:"​"}    literal U+200B

Vite inlines the pico.min.css stylesheet into the single-file dist/index.html, so the literal byte ends up committed to the repo.

Fix

Since dist/index.html is a committed build artifact that CI rebuilds on every push to master, simply editing the file would let the character come back on the next rebuild. This PR fixes it at the build step:

  1. scripts/strip-invisible.mjs (new) — a post-build sanitizer that scans the generated bundle and replaces hidden/invisible Unicode characters with safe ASCII equivalents. The U+200B is replaced with its semantically-identical CSS escape \200B (valid inside a CSS content:"…" string, but with no hidden bytes). It also warns loudly if any other suspicious invisible/bidi characters are found.

  2. package.json — added a postbuild lifecycle hook (node scripts/strip-invisible.mjs) so every bun run build / npm run build produces clean output automatically.

  3. dist/index.html — cleaned the already-committed artifact (the only character flagged).

Verification

  • Scanned all tracked files for the full set of invisible/bidi/confusable Unicode ranges → no matches remain.
  • The sanitizer is idempotent (a second run is a no-op).
  • The CSS escape \200B is functionally identical to the literal U+200B inside content:"", so rendering/behavior is unchanged.
## Summary Fixes #5 — resolves the Renovate warning about hidden Unicode characters in the repository. ## Root cause Renovate flagged a hidden Unicode character in the repo. The only occurrence was a **zero-width space (U+200B)** in `dist/index.html`, inside a CSS rule that originates from the `@picocss/pico` framework: ```css :where(nav li):before{float:left;content:"​"} ← literal U+200B ``` Vite inlines the pico.min.css stylesheet into the single-file `dist/index.html`, so the literal byte ends up committed to the repo. ## Fix Since `dist/index.html` is a committed build artifact that CI rebuilds on every push to `master`, simply editing the file would let the character come back on the next rebuild. This PR fixes it at the build step: 1. **`scripts/strip-invisible.mjs`** (new) — a post-build sanitizer that scans the generated bundle and replaces hidden/invisible Unicode characters with safe ASCII equivalents. The U+200B is replaced with its semantically-identical CSS escape `\200B` (valid inside a CSS `content:"…"` string, but with no hidden bytes). It also warns loudly if any other suspicious invisible/bidi characters are found. 2. **`package.json`** — added a `postbuild` lifecycle hook (`node scripts/strip-invisible.mjs`) so every `bun run build` / `npm run build` produces clean output automatically. 3. **`dist/index.html`** — cleaned the already-committed artifact (the only character flagged). ## Verification - Scanned all tracked files for the full set of invisible/bidi/confusable Unicode ranges → no matches remain. - The sanitizer is idempotent (a second run is a no-op). - The CSS escape `\200B` is functionally identical to the literal U+200B inside `content:""`, so rendering/behavior is unchanged.
fix: strip hidden Unicode (U+200B) from build output
All checks were successful
Build / build (push) Successful in 22s
6a52034d4e
Co-authored-by: alex <alex@forge.l3x.in>
alex merged commit 6a52034d4e into master 2026-07-16 04:17:29 +00:00
alex deleted branch pi/issue5-1784175204059 2026-07-16 04:17:29 +00:00
Sign in to join this conversation.
No reviewers
No labels
dependencies
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alex/opengist-viewer!6
No description provided.