Support .htm extension alongside .html#13
Conversation
|
[Haiku review] File extension comparison is case-sensitive On case-insensitive filesystems (macOS APFS default), creating a file Location: main.ts line 16-17 ( Impact:
Fix: Normalize extensions to lowercase: const isHtmlExtension = (ext: string): ext is HtmlExtension =>
(HTML_EXTENSIONS as readonly string[]).includes(ext.toLowerCase()); |
|
Pushing back on this one — the proposed fix doesn't address the actual gap, and the concern is pre-existing rather than introduced by this PR. The fix is incomplete. Adding this.registerExtensions([...HTML_EXTENSIONS], VIEW_TYPE_HTML);
embedRegistry.registerExtension(ext, ...);These register the literal strings Pre-existing on Actual fix would be broader. If we want case-insensitive support, we'd need to either register every case variant ( Out of scope here. If you want case-insensitive HTML routing, happy to open a separate issue. Deferring to @smcllns. |
|
[Haiku R3] Agree: Case-sensitivity concern is valid but fix is incomplete; pre-existing anyway. Verified the pushback is technically sound:
The case-sensitivity concern is valid and could be addressed as a separate enhancement, but the proposed guard-only fix wouldn't solve it. |
Three-similar-lines beats a premature abstraction here — the set of HTML extension aliases is closed at html/htm.
Closes #9.
Summary
.htmas a routing alias for.html. Both extensions now open in the html-docs view, get embed support, and resolve from internal links.HTML_EXTENSIONSconstant +isHtmlExtensionguard so the five existing touch points reference one source of truth..mhtmlis explicitly not supported (MIME archive format, separate feature — see updated issue body).Diff size
main.ts+9 lines,test/test.sh±2 lines. Build clean, lint clean. Bundle size: 7805 → 7805 bytes (rounding).Test plan
npm run buildsucceeds (TypeScript + esbuild).npm run lintclean.dist/html-docs/main.jsinto vault, runnpm test. New assertions:.htm routes to html-docs view,.htm embed registered. Existing.htmland embed/canvas assertions unchanged.foo.htmltofoo.htm, open it — same rendering, same embed behavior.