Markdown rendering

bext-v8 exposes __readFile and __readFileExists as bridge natives, so a page can read a content file from disk at SSR time and pipe it through any npm rendering library — here, marked. The result lands in JSX as a <Raw> child (the explicit opt-out from auto-escape).

Rendered from src/content/example.md

Hello from Markdown

This is a demo .md file rendered through marked at SSR time.

Why this works

bext's V8 isolate exposes a few bridge natives — __readFile and __readFileExists — that let server-side rendered components read files from disk during render. Combined with the marked package from npm, that's enough to ship a small MDX-style content site without a separate build step.

A code block

import { marked } from "marked";

declare function __readFile(path: string): string;

export default function Page(): string {
  return marked.parse(__readFile("./src/content/example.md")) as string;
}

A list, just because

- bext renders this server-side

- marked is invoked inside V8 (no Node)

- the result is an HTML string handed to the JSX runtime via Raw

Real docs sites layer in syntax highlighting, frontmatter, heading anchors, and component injection. This demo keeps it small.

Source

import { marked } from "marked";
    import { Raw } from "@bext-stack/framework/jsx-runtime";

    declare function __readFile(path: string): string;

    export default function Page() {
        const md = __readFile("./src/content/example.md");
        const html = marked.parse(md) as string;
        return <article><Raw html={html} /></article>;
    }