macana

Static site generator for Obsidian Vault

Use hastscript instead of nano_jsx The first reason for this change is tedious conversion from Markdown to components. Since Hast does not have a concept of "Component", those needs to be converted to custom elements first, then restored by carefully mapping the custom element nodes. During that process, properties are transformed to HTML attributes (e.g. true -> ""). This is very error-prone and exhausting thing to write. The second one is the quality of nano-jsx. The library is, honestly, toy-level. Even though they promote it as "SSR First", HTML seriealization is joke: empty children appears as `children=""`, cannot handle falsy attribute values, renders `true` attribute value as `"true"`, etc... Also, it's TypeScript typing is almost non-existent. Most of the exposed things are typed as `any`. I would not call that a typed library. While hastscript is not perfect either, it's good enough for my HTML generation usecase. It also eliminates Mdast -> Hast -> (JSX runtime) confusing data conversion. I choose not to write wrapper for `<Component/>` usage. It's nice, but not necessary. In fact, normal function call is **far better** than JSX's loose and cryptic typings. The only output changes I observed was "Module" and "Program" in "Architecture.canvas" now overflows (thus broken in Safari). However, it's due to the new more strict CSS. I believe it's improvement, not regression (needs to be fixed the overall JSONCanvas stylings at some point, though).

Changes

35 changed files (+1507/-1768)