• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
nbbaier

nbbaier

vt-ssg

Lightweight SSG: markdown + JSX layout → HTML string
Public
Like
vt-ssg
Home
Code
8
output
1
README.md
defaults.tsx
frontmatter.ts
main.tsx
markdown.ts
test.tsx
types.ts
Connections
Environment variables
1
Branches
2
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v83
View latest version
README.md

vt-ssg

A lightweight static site generator for Val Town. Takes a markdown string and a JSX layout template, returns an HTML string.

Stack: marked · gray-matter · Hono JSX

Usage

/** @jsxImportSource npm:hono@4/jsx */ import { render } from "https://esm.town/v/nbbaier/vt-ssg/main.tsx"; const html = await render({ markdown: `--- title: Hello World date: 2026-04-04 --- # Hello Some **markdown** content.`, }); // html is a complete HTML string with <!DOCTYPE html>

Custom Layout

Pass a Hono JSX component as the layout option. It receives title, content (rendered HTML), and the full frontmatter object as props.

/** @jsxImportSource npm:hono@4/jsx */ import { render } from "https://esm.town/v/nbbaier/vt-ssg/main.tsx"; import type { LayoutComponent } from "https://esm.town/v/nbbaier/vt-ssg/types.ts"; const BlogLayout: LayoutComponent = ({ title, content, frontmatter }) => ( <html lang="en"> <head> <title>{title} | My Blog</title> <link rel="stylesheet" href="/styles.css" /> </head> <body> <header><nav>Home | About</nav></header> <article> <h1>{title}</h1> <time>{String(frontmatter.date)}</time> <div dangerouslySetInnerHTML={{ __html: content }} /> </article> <footer>© 2026</footer> </body> </html> ); const html = await render({ markdown: source, layout: BlogLayout, layoutProps: { theme: "dark" }, });

API

render(options: RenderOptions): Promise<string>

OptionTypeRequiredDescription
markdownstring✅Raw markdown string, optionally with YAML frontmatter
layoutLayoutComponent❌Hono JSX component. Defaults to a minimal HTML shell.
layoutPropsRecord<string, unknown>❌Extra props merged into the layout props
markedOptionsMarkedOptions❌Options passed to marked. GFM enabled by default.

LayoutProps

Props received by layout components:

PropTypeDescription
titlestringExtracted from frontmatter.title, or ""
contentstringRendered HTML from the markdown body
frontmatterRecord<string, unknown>Full parsed frontmatter object
...layoutPropsunknownAny extra props passed via layoutProps

Architecture

Rendering mermaid diagram...

File Structure

main.tsx         — Public API: render() function
types.ts         — TypeScript type definitions
frontmatter.ts   — gray-matter wrapper
markdown.ts      — marked wrapper
defaults.tsx     — Default HTML layout component
test.tsx         — Test script
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
AboutAlternativesPricingBlogNewsletterCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.