docs: add dedicated docs website

This commit is contained in:
Johann Schopplich
2025-11-18 07:23:10 +01:00
parent 3e08f3b72b
commit 4b4f7c05f9
38 changed files with 4399 additions and 541 deletions

134
docs/.vitepress/config.ts Normal file
View File

@@ -0,0 +1,134 @@
import type { DefaultTheme } from 'vitepress'
import UnoCSS from 'unocss/vite'
import { defineConfig } from 'vitepress'
import { description, github, name, ogImage, ogUrl, releases, twitterImage, version } from './meta'
export default defineConfig({
title: name,
description,
head: [
['link', { rel: 'icon', href: '/favicon.svg', type: 'image/svg+xml' }],
['meta', { name: 'author', content: 'Johann Schopplich' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:url', content: ogUrl }],
['meta', { property: 'og:title', content: name }],
['meta', { property: 'og:description', content: description }],
['meta', { property: 'og:image', content: ogImage }],
['meta', { name: 'twitter:title', content: name }],
['meta', { name: 'twitter:description', content: description }],
['meta', { name: 'twitter:image', content: twitterImage }],
['meta', { name: 'twitter:site', content: '@jschopplich' }],
['meta', { name: 'twitter:creator', content: '@jschopplich' }],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
],
vite: {
// @ts-expect-error UnoCSS types are not compatible with Vite yet
plugins: [UnoCSS()],
},
themeConfig: {
logo: {
dark: '/logo-nav-dark.svg',
light: '/logo-nav-light.svg',
},
nav: [
{
text: 'Guide',
activeMatch: '^/guide/',
items: [
{ text: 'Getting Started', link: '/guide/getting-started' },
{ text: 'Format Overview', link: '/guide/format-overview' },
{ text: 'Using TOON with LLMs', link: '/guide/llm-prompts' },
{ text: 'Benchmarks', link: '/guide/benchmarks' },
],
},
{
text: 'CLI',
link: '/cli/',
},
{
text: 'Reference',
activeMatch: '^/reference/',
items: [
{ text: 'API', link: '/reference/api' },
{ text: 'Syntax Cheatsheet', link: '/reference/syntax-cheatsheet' },
{ text: 'Specification', link: '/reference/spec' },
],
},
{
text: 'Ecosystem',
activeMatch: '^/ecosystem/',
items: [
{ text: 'Tools & Playgrounds', link: '/ecosystem/tools-and-playgrounds' },
{ text: 'Implementations', link: '/ecosystem/implementations' },
],
},
{
text: `v${version}`,
items: [
{
text: 'Release Notes',
link: releases,
},
],
},
],
sidebar: {
'/guide/': sidebarPrimary(),
'/cli/': sidebarPrimary(),
'/reference/': sidebarPrimary(),
'/ecosystem/': sidebarPrimary(),
},
socialLinks: [
{ icon: 'github', link: github },
],
footer: {
message: 'Released under the <a href="https://opensource.org/licenses/MIT" target="_blank">MIT License</a>.',
copyright: 'Copyright © 2025-PRESENT <a href="https://github.com/johannschopplich" target="_blank">Johann Schopplich</a>',
},
search: {
provider: 'local',
},
},
})
function sidebarPrimary(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Guide',
items: [
{ text: 'Getting Started', link: '/guide/getting-started' },
{ text: 'Format Overview', link: '/guide/format-overview' },
{ text: 'Using TOON with LLMs', link: '/guide/llm-prompts' },
{ text: 'Benchmarks', link: '/guide/benchmarks' },
],
},
{
text: 'Tooling',
items: [
{ text: 'CLI Reference', link: '/cli/' },
{ text: 'Tools & Playgrounds', link: '/ecosystem/tools-and-playgrounds' },
],
},
{
text: 'Ecosystem',
items: [
{ text: 'Implementations', link: '/ecosystem/implementations' },
],
},
{
text: 'Reference',
items: [
{ text: 'API (TypeScript)', link: '/reference/api' },
{ text: 'Syntax Cheatsheet', link: '/reference/syntax-cheatsheet' },
{ text: 'Specification', link: '/reference/spec' },
],
},
]
}

12
docs/.vitepress/meta.ts Normal file
View File

@@ -0,0 +1,12 @@
export { description, version } from '../../packages/toon/package.json'
/* VitePress head */
export const name = 'TOON'
export const ogUrl = 'https://toonformat.dev/'
export const ogImage = `${ogUrl}og.png`
export const twitterImage = `${ogUrl}twitter.png`
/* GitHub and social links */
export const github = 'https://github.com/toon-format/toon'
export const releases = 'https://github.com/toon-format/toon/releases'
export const twitter = 'https://twitter.com/jschopplich'

View File

@@ -0,0 +1,9 @@
import DefaultTheme from 'vitepress/theme'
import './vars.css'
import './overrides.css'
import 'uno.css'
export default {
...DefaultTheme,
}

View File

@@ -0,0 +1,16 @@
.dark [img-light] {
display: none;
}
html:not(.dark) [img-dark] {
display: none;
}
details summary {
cursor: pointer;
}
.VPHomeHero .image-src {
max-width: 180px !important;
max-height: 180px !important;
}

View File

@@ -0,0 +1,41 @@
/**
* Colors Theme
* -------------------------------------------------------------------------- */
:root {
--vp-c-brand-1: #d97c06;
--vp-c-brand-2: #C57105;
--vp-c-brand-3: #B16505;
--vp-nav-logo-height: 20px;
}
/**
* Component: Home
* -------------------------------------------------------------------------- */
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
120deg,
#fde98a 15%,
#d97c06
);
--vp-home-hero-image-background-image: linear-gradient(
-45deg,
#d97c0660 30%,
#fde98a60
);
--vp-home-hero-image-filter: blur(30px);
}
@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}
@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(72px);
}
}