Translation Layer
This is where the project lives or diesEvery other component in cyberbaser is solvable with off-the-shelf parts. The translation layer is the hot spot. If we can’t guarantee round-trip fidelity for the Tier 1 features below, the “three contribution paths” vision collapses to “one path plus some lossy alternatives.”
What it does
Section titled “What it does”A pipeline of remark (markdown AST) and rehype (HTML AST) plugins composed on top of Astro’s content loading. Takes an Obsidian-flavored markdown file as input, produces (a) rendered HTML for the web wiki and (b) enough preserved structure that a Web CMS edit round-trips cleanly back to the source file.
The tiered feature list
Section titled “The tiered feature list”This is the contract. A feature’s tier determines its level of support and the amount of engineering it justifies.
Tier 1 — Full Support (round-trip required)
Section titled “Tier 1 — Full Support (round-trip required)”These features must survive edits from any contribution path. If the Web CMS edits a page and the roundtripped file doesn’t equal the original (modulo intentional changes), the tier fails.
| Feature | Source syntax | Plugin | Status |
|---|---|---|---|
| Wikilinks | Page, alias | remark-wiki-link | Scoped |
| Callouts | > [!note], > [!warning], > [!tip]+ | remark-obsidian-callout | Scoped |
| Image embeds | ![[image.png]] | Custom remark plugin | Pending |
| Note embeds | ![[Other Note]], ![[Other#Section]] | Custom remark plugin | Pending |
| Code blocks | Fenced, language-tagged | Astro/Starlight built-in | OK |
| Math | $inline$ and $$block$$ | remark-math + rehype-katex | Pending |
| Mermaid diagrams | Fenced mermaid blocks | rehype-mermaid | OK |
| Tables | Standard markdown tables | Built-in | OK |
Tier 2 — Partial Support (best-effort, never lossy)
Section titled “Tier 2 — Partial Support (best-effort, never lossy)”These features render something but may lose fidelity. Important constraint: a Tier 2 feature should never silently corrupt a round-trip. If we can’t preserve it fully, we render a best-effort fallback and leave the source markdown alone.
- Simple Dataview queries —
LIST FROM #tag, basicTABLE. Rendered as a resolved list at build time; the query text is preserved as a comment for round-trip. - Block references —
Note#^blockid. Resolved to the target block’s content with an anchor; block ID preserved. - Aliases (frontmatter
aliases:) — rendered as redirect pages; original frontmatter untouched. - Frontmatter metadata — exposed as page properties / status badges; original keys preserved.
Tier 3 — Not Supported (workaround documented)
Section titled “Tier 3 — Not Supported (workaround documented)”These features cyberbaser will not translate. For each, we need a documented contributor-facing workaround — otherwise contributors will hit a silent failure mode.
- Complex Dataview JS — use Tier 2 simple queries or pre-compute a static table.
- Canvas files (
.canvas) — export to SVG/PNG and embed via standard markdown image. - Templater / DataviewJS plugins — render output to static markdown before commit.
- Graph view — inherently interactive; replaced by
starlight-site-graphon the web.
Round-trip correctness — the test corpus
Section titled “Round-trip correctness — the test corpus”The single most important artifactA test corpus where each Tier 1 / 2 feature has:
- A fixture vault page written by hand
- Expected web output (HTML snapshot)
- A “Web CMS edit → vault diff” round-trip snapshot proving A → B → A === A
Until this exists, “round-trip editability” is an aspiration instead of a tested property. Building this corpus is on the critical path for Phase 1.
Open research questions
Section titled “Open research questions”These live in Open Questions but collecting them here because they all touch the translation layer:
- Is
astro-loader-obsidiansufficient for Tier 1? Does it handle wikilinks, callouts, and embeds, or does it need augmentation? Unknown. - How does the Web CMS render Tier 2/3 features it can’t preview? Raw markdown? Rich editor with degraded modes? Hide behind a “view raw” toggle?
- How do we enforce round-trip correctness at CI time? Property-based tests? Snapshot diffing? Is there a testing framework that models markdown round-trips well?
- Where should backlinks data be computed? Inside the content loader as part of the AST, or as a post-build rehype pass over the full page set?
- What’s the incremental build story? A 1000-page vault with a one-page edit shouldn’t trigger a full rebuild. Astro 5+ has improved incremental support but this needs benchmarking on a realistic vault.