Configuration#
docia reads configuration from docia.config.ts by default.
Example:
import { defineConfig } from "docia";
export default defineConfig({
srcDir: "book",
outDir: "dist",
publicDir: "public",
basePath: "/",
prettyUrls: true,
site: {
title: "My Docs",
description: "Product and API documentation",
language: "en",
url: "https://docs.example.com",
ogImage: "/og.png",
socials: {
github: "https://github.com/acme/docs",
x: "https://x.com/acme",
},
githubEditBaseUrl: "https://github.com/acme/docs/edit/main/book",
githubEditBranch: "main",
githubEditPath: "book",
},
theme: {
logo: "/logo.svg",
favicon: "/favicon.svg",
accentColor: "#0d9488",
customCss: ["/custom.css"],
colorMode: "system",
},
images: {
optimize: true,
jpegQuality: 82,
webpQuality: 82,
pngCompressionLevel: 9,
maxPixels: 64_000_000,
},
markdown: {
headings: { ids: true },
autolinks: true,
tables: true,
tasklists: true,
strikethrough: true,
tagFilter: true,
},
});
Core options#
srcDir: source markdown rootoutDir: generated static outputpublicDir: static asset input directorybasePath: URL prefix for subpath hosting (for example/docs)prettyUrls:/chapter/style routes vs.htmlroutes
Site metadata#
site.title: global site titlesite.description: default page descriptionsite.language: HTMLlangsite.url: canonical base URL used by SEO artifactssite.socials.github: optional GitHub link shown in sidebarsite.socials.x: optional X link shown in sidebarsite.githubEditBaseUrl: optional full GitHub edit URL prefix for source filessite.githubEditBranch: branch used when deriving edit links fromsite.socials.githubsite.githubEditPath: repo path to docs source (defaults tosrcDir)site.ogImage: default social preview image
Theme options#
theme.logo: optional logo shown beside the site titletheme.favicon: favicon path, or an empty string to omit ittheme.accentColor: optional CSS color used for links and controlstheme.customCss: additional local or external stylesheets loaded after docia's stylestheme.colorMode: initialsystem,light, ordarkappearance; readers can override it
Markdown options#
docia uses Bun's markdown parser and supports Bun parser options via markdown.
Useful defaults are already enabled, including headings IDs and common GFM features.
Image options#
Raster images in publicDir are optimized during production and development builds with Bun.Image.
URLs and file formats stay unchanged, and docia keeps the original whenever re-encoding would make a
file larger. SVG, GIF, AVIF, HEIC, and other files are copied without transformation.
images.optimize: enable build-time optimization (defaulttrue)images.jpegQuality: JPEG quality from 1 to 100 (default82)images.webpQuality: WebP quality from 1 to 100 (default82)images.pngCompressionLevel: lossless PNG compression from 0 to 9 (default9)images.maxPixels: maximum decoded pixel count per image (default64_000_000)
Unknown configuration keys fail with a descriptive error so misspelled options cannot be silently ignored.