import {expect, test} from 'bun:test' import {inline, linkSessions, markdown} from '@/lib/markdown' // Vnodes as plain data: the tag and the text inside, enough to see the shape. type Node = {tag?: string; children?: unknown[]; text?: unknown; attrs?: Record} const shape = (x: unknown): unknown => { if (Array.isArray(x)) return x.map(shape) if (x == null || typeof x !== 'object') return x const n = x as Node const raw = n.children ?? (n.text != null ? [n.text] : []) const kids = Array.isArray(raw) ? raw : [raw] if (n.tag === '#') return n.children ?? n.text return {[String(n.tag)]: kids.map(shape).filter((k) => k !== null && k !== undefined)} } const flat = (x: unknown): string => JSON.stringify(shape(x)) test('inline marks become elements and stay text', () => { const s = flat(inline('run `cargo test`, **then** look at *this* [page](https://x.org) or