Built with ArtScript
This website is an ArtScript app
It is 9 .art files with 1088 lines, plus a stylesheet. The build compiles them, prerenders every page to HTML and copies the Markdown for AI agents: npm run site. Small TypeScript helpers, imported with use, render the repository's Markdown and run the compiler in the playground.website/site.art192
Layout, navigation, footer and shared components (Code, Markdown, DocPage)website/home.art191
This home pagewebsite/docs.art114
Every guide and spec pagewebsite/reference.art74
UI elements and errors, read from the compilerwebsite/ai.art151
The For AI pagewebsite/playground.art75
The playground (the compiler running in your browser)website/benchmarks.art195
Benchmarks, charted from the README's resultswebsite/examples.art61
The examples gallerywebsite/source.art35
This pagewebsite/site.css380
The theme and the page layoutsuse "./lib/content.ts" { NAV, REPO, setupHead, prefersDark, docBySlug, docHeadings, docFile, editUrl, renderDoc, prevPage, nextPage, artFiles, artLines }
use "./lib/markdown.ts" { codeBlock, onDocClick, copyText }
use "./lib/motion.ts" { setupMotion }
layout Site {
state menu = false
computed dark = theme() == "dark" || theme() == "auto" && prefersDark()
mount {
setupHead()
setupMotion()
}
column gap=0 {
link "Skip to content" href="#main" class="skip-link"
column class="site-header" tag=header {
row class="container bar" justify=between gap=4 {
row gap=6 {
link "ArtScript" to="/" class="logo" aria-label="ArtScript home"
row gap=1 class=(menu ? "nav open" : "nav") tag=nav aria-label="Main" {
link "Learn" to="/learn" on:click=(menu = false)
link "Reference" to="/reference/spec" on:click=(menu = false)
link "For AI" to="/ai" on:click=(menu = false)
link "Examples" to="/examples" on:click=(menu = false)
link "Benchmarks" to="/benchmarks" on:click=(menu = false)
link "Playground" to="/playground" on:click=(menu = false)
}
}
row gap=2 {
link "Built with ArtScript" to="/source" class="badge-built"
link "GitHub" href=REPO class="pill gh"
button (dark ? "Switch to light theme" : "Switch to dark theme") class="ghost icon-btn theme-btn" -> setTheme(dark ? "light" : "dark")
button (menu ? "Close menu" : "Open menu") class="ghost icon-btn menu-btn" aria-expanded=menu -> menu = !menu
}
}
}
column tag=main id="main" tabindex="-1" gap=0 {
slot
}
Footer
}
}
component Footer {
column class="footer" tag=footer {
column class="container" gap=8 {
grid cols=2 md:cols=4 lg:cols=5 gap=6 {
column gap=3 align=start class="foot-brand" {
link "ArtScript" to="/" class="logo"
text "The full-stack web framework built for AI agents." class="made"
}
column gap=2 align=start {
text "Learn" class="col-title"
link "Introduction" to="/learn"
link "Quick start" to="/learn/quick-start"
link "Tutorial" to="/learn/tutorial"
link "Recipes" to="/learn/recipes"
link "Deploying" to="/learn/deploy"
}
column gap=2 align=start {
text "For AI" class="col-title"
link "Overview" to="/ai"
link "Working with agents" to="/ai/agents"
link "llms.txt" href="/llms.txt"
link "llms-full.txt" href="/llms-full.txt"
}
column gap=2 align=start {
text "Reference" class="col-title"
link "Language spec" to="/reference/spec"
link "UI elements" to="/reference/elements"
link "Errors" to="/reference/errors"
link "CLI" to="/reference/cli"
}
column gap=2 align=start {
text "Project" class="col-title"
link "GitHub" href=REPO
link "Benchmarks" to="/benchmarks"
link "Security" to="/reference/security"
link "Status" to="/status"
link "This site's source" to="/source"
}
}
divider
row justify=between wrap gap=3 {
text `This website is built with ArtScript: ${artFiles.length} .art files, ${artLines} lines.` class="made"
row gap=2 wrap class="made" {
text "Made by"
link "Leandro Bisceglie" href="https://github.com/leb90"
text "· MIT License"
}
}
}
}
}
// A highlighted code block with a copy button.
component Code(src: String, lang: String = "art") {
ref box
effect {
box.innerHTML = codeBlock(src, lang)
}
column ref=box class="code-box" on:click=onDocClick(event)
}
// HTML rendered from Markdown at build time (and again in the browser).
component Markdown(html: String) {
ref box
effect {
box.innerHTML = html
}
column ref=box class="prose" on:click=onDocClick(event)
}
// Every docs page renders inside this layout, itself inside Site: the sidebar stays mounted (and
// keeps its scroll) between pages, and the router marks the current link with aria-current.
layout Docs layout Site {
state open = false
grid class="container docs" {
column class="docs-nav" gap=0 {
button (open ? "Hide menu" : "All pages") small class="ghost docs-toggle" -> open = !open
column gap=0 class=(open ? "sidebar open" : "sidebar") tag=nav aria-label="Documentation" {
for s in NAV {
text s.title class="group"
for it in s.items {
link it.title to=it.path on:click=(open = false)
}
}
}
}
slot
}
}
// The content of a docs page: title, content, previous/next and "on this page".
component DocShell(path: String, section: String, heading: String, slug: String = "") {
computed prev = prevPage(path)
computed next = nextPage(path)
column class="doc-main" gap=0 {
text section class="crumb"
title heading class="doc-title" tag=h1
slot
row gap=4 class="pager" {
if prev {
link `← ${prev.title}` to=prev.path
}
if next {
link `${next.title} →` to=next.path class="next"
}
}
}
if slug != "" {
column class="toc" gap=0 tag=nav aria-label="On this page" {
text "On this page" class="group"
for h in docHeadings(slug) {
link h.text href=`#${h.id}` class=(h.level == 3 ? "sub" : "")
}
}
}
}
// A docs page from a Markdown file of the repository.
component DocPage(slug: String) {
computed doc = docBySlug(slug)
DocShell path=doc.path section=doc.section heading=doc.title slug=slug {
row gap=2 wrap class="doc-tools" {
button "Copy page for your AI" small class="pill" -> copyText(doc.md)
link "Markdown" href=docFile(slug) class="pill"
link "Edit on GitHub" href=editUrl(slug) class="pill"
}
Markdown html=renderDoc(slug)
}
}
page NotFound "*" {
meta title="Not found · ArtScript"
column class="container page-pad" gap=4 align=start {
text "404" class="crumb"
title "This page doesn't exist" class="page-title" tag=h1
text "It may have moved. The docs start here:" class="page-lead"
row gap=3 {
link "Learn ArtScript" to="/learn" class="btn primary"
link "Home" to="/" class="btn"
}
}
}