macana

Static site generator for Obsidian Vault

Commits at b505eced61966ea4de26f66e6c28033e3b1a7cf4

  1. b505eced Wikilink hash resolver for headings Shota FUJI authored at Shota FUJI comitted at
  2. 242529dc Add logging options for docs build script Sometime I need full debug log, sometime I only need build time stats. Or I could just want to know whether the build succeeds. Shota FUJI authored at Shota FUJI comitted at
  3. b29abcb1 Disable log color based on whether stdout is tty It was mostly for jq. But "disabling colors because output is JSON" is completely incorrect: it's assumption based on author's usage, not technical constraints. I myself too sometime want to see colored JSON output for debugging. Shota FUJI authored at Shota FUJI comitted at
  4. 52dd2476 Update roadmap I remembered the missing tasks. Shota FUJI authored at Shota FUJI comitted at
  5. 3edb4ba7 Align directory and document (tree UI) Due to documents not having padding at left, I sometime confuse that the document is at the same level to the parent directory, like this: ``` # actual + dir1 + dir2 + file1 + file2 # confused + dir1 + dir2 + file1 + file2 ``` Shota FUJI authored at Shota FUJI comitted at
  6. 1cc8ae3a Replace "Writing Samples" with "Features" "Features" is more approachable and more common. Shota FUJI authored at Shota FUJI comitted at
  7. f21848e2 Make Roadmap more concrete Shota FUJI authored at Shota FUJI comitted at
  8. 1c5f9c6d Place `<img>` as block element This is as same as Obsidian renders. Also, from my private testing, inline images work horribly. This would work "okay" in most cases. Shota FUJI authored at Shota FUJI comitted at
  9. bf4a2248 Fix document tree uses actual directory name, not metadata name The `currentPath` is from `Document.path`, which consists of metadata names. Shota FUJI authored at Shota FUJI comitted at
  10. 8bc70dc6 Highlight current page in document tree I myself sometimes confused like "wait, where am I?". I could have add more eye-candy, but this is enough. Shota FUJI authored at Shota FUJI comitted at
  11. 12634f1f Align vertical line to chevron on document directory Shota FUJI authored at Shota FUJI comitted at
  12. 47b29d02 Remove unnecessary line-height from inline elements I'm not sure the intent for those (yes, I'm the who wrote those). `<sup>` (superscript) and `<sub>` (subscript) still have `line-height`. Without this, they somehow dramatically expand the line and break the vertical rhythm. Shota FUJI authored at Shota FUJI comitted at
  13. 632084fd Delete unused style Probably related to my old blog styles. Macana does not contain `<button>`, and even if it does, styling should be done via class. Shota FUJI authored at Shota FUJI comitted at
  14. 04687860 Do not set vertical rhythm on body This has been causing a lot of problems. The most important thing here is vertical rhythm is for (usually long) textual content. In the context of documentation/blog website, contents inside `<main>`. Other parts, such as navigation and table of contents, are not suitable for vertical rhythm. Aesthetics and/or space effeciency is more important than the rhythm. Shota FUJI authored at Shota FUJI comitted at
  15. 69036d6f Dev docs for profiling I tried to optimize build process so the docs can be built under 150ms. Currently, on my M1 Mac mini, it takes 180ms~210ms. I think it's too much for just 16 documents. I'm not good at profiling or optimization or whatever. I suck at looking at profiling result. What the fuck is bottom-up? But I have to profile in order to optimize further more. Luckily, Deno/V8's profiler is easy to use and call tree representation is intuitive even for beginers like me. Unfortunately, most of the process time is from third-party libraries. The most time consuming one was refractor (syntax highlighting) and the second was hast-util-to-html or mdast-from-markdown (or inner micromark). All of those are reasonable: refractor's "all" entrypoint (I willingfully choose this) contains every language syntax, thus it takes a lot of time loading and registering syntaxes. Seriealizing HTML and parsing Markdown are, well, time-consuming considering they are written in JavaScript, which is difficult to write performant string ops (esp. spatial efficiency). In its current form, the most impactful performance optimization I can think of is not emitting embed page until required. In order to do that, I have to make significant changes to how page builder handles build queue (or make one). While I found out there are no low-haning fruit for temporal optimization, I believe an experience and knowledge I gained from this should be noted and shared anyhow. So here it is. Shota FUJI authored at Shota FUJI comitted at
  16. 8243be61 Layout properly The whole styles are copy and pasted from my old blog. This patch tidies things up. There still needs some maintenance, such as color tokens and line-height, I think this is okay-ish to commit. Shota FUJI authored at Shota FUJI comitted at
  17. c1e620ab Remove debug texts from test document Shota FUJI authored at Shota FUJI comitted at
  18. d4516531 Fix long external link wraps unnaturally or overflows the page horizontally Shota FUJI authored at Shota FUJI comitted at
  19. d83004e3 Style blockquote Shota FUJI authored at Shota FUJI comitted at
  20. fbdbe5a0 Use helper for HTML class generation instead of simple `const enum` Manual naming using `const enum` works fine. It's definitely better than using bare string literals. However it's error-prone and difficult to maintain short class names: even if I take care on unique prefix constraint, class names would collide inside a namespace if the file have many class names. This problem became noticable when I authored the `from_mdast/code.tsx`, which defines every class names for Prism tokens. This patch frees mental overhead of carefully defining actuall class names, and (hopefully) helps compression algorithms (e.g. gzip) to work better because of repeated patterns after prefixes. Shota FUJI authored at Shota FUJI comitted at
  21. 48b04db3 Delete unused imports I thought it errors on `check` command since LS shows warning on unused imports. Shota FUJI authored at Shota FUJI comitted at
  22. f81aeb55 Do not fade-out document-tree and toc on non-hover environment This effect only works when a user's primary input device is hover-capable device (e.g. mouse, pen) or focus-navigatable device (e.g. keyboard). If a user is using neither of those, the document-tree and toc UI is always dimmed. Or worse, a user may think it as some kind of broken CSS. In order to maintain legibility for non-hover environments (mostly touch-only environments), I restricted the rule to when the primary input device is hover-capable. This prevents the effect from running on non-hover but keyboard navigatable environemts, such as using keyboard on touch-only device. However, as the effect is just to help users for focusing a main content, legibility wins over it. Shota FUJI authored at Shota FUJI comitted at
  23. 49519dad Improve create/update datetime formatting, more concise and consistent This patch reduces clutters in a datetime string and make the string more consistent to other parts of the document. The first and most significant problem was the datetime string is formatted using UA's locale. The UA's locale could be different to a document's locale. This results in inconsistent text formatting: for example, when a user viewing the page with `lang="ja"` but UA uses "en-US", chunk of "en-US" text appears in "ja" document as a result. The second problem is the datetime string is verbose. I can't imagine any usecase where seconds part benefits a user (viewer). The final problem is ugliness of the datetime string in noscript env. It's ISO-8601 string because of timezone. I remembered that `toLocaleString` (`Intl.DateTimeFormat`) can display timezone string, so here it is. Even though the metadata is not properly styled and is still ugly, I'm satisfied how the result looks good without compromising semantic markup and/or build process. Shota FUJI authored at Shota FUJI comitted at
  24. 35ce077d Use page title as a label text for Obsidian's formatting pages With external link icons, they are no longer confusing. This form also looks far better than bare URL. Shota FUJI authored at Shota FUJI comitted at
  25. 8526d465 Style anchors using class selector, rather than type selector Type selector, which selects all tags/elements that matches, often causes unexpected side-effect. For example, if an internal component includes anchor element, the default style for contents also applys to the internal anchor, which is not desirable. Shota FUJI authored at Shota FUJI comitted at
  26. bd077317 Style syntax highlighted code block This patch also removes annoying semi-global style for main contents. Shota FUJI authored at Shota FUJI comitted at
  27. ab50391e Math extension (Obsidian Flavored Markdown) Shota FUJI authored at Shota FUJI comitted at
  28. 53e5cf0e Make embedded document's background transparent (JSONCanvas) File node could have its own color. Shota FUJI authored at Shota FUJI comitted at
  29. 2510eb58 Fix path pointing to one level higher directory Shota FUJI authored at Shota FUJI comitted at
  30. 94b55a12 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). Shota FUJI authored at Shota FUJI comitted at