DocsLit 0.1.7: Shiki highlighting and OpenAPI docs
DocsLit 0.1.7 adds build-time Shiki syntax highlighting, a Save as PDF button, and a docslit openapi scaffold command that generates an API reference.
DocsLit 0.1.7 improves how code looks and adds a way to generate a full API reference from an OpenAPI spec. It also adds a one-click PDF export for any page.
Better code blocks
Code blocks now use Shiki, which highlights at build time, so readers pay no highlighting cost in the browser. Blocks follow the page's light or dark theme. A kebab menu on each block lets a reader switch code between light and dark independently of the page, and the choice is saved for next time.
- Tabbed code groups get a copy button, matching single code blocks.
- Add
linenumbers="true"to a code block to show a line number gutter. It is off by default.
Details are on the code blocks page.
API docs from an OpenAPI spec
Point DocsLit at an OpenAPI 3.x spec and run docslit openapi scaffold. Every endpoint gets its own page, with parameters, request bodies, response fields and examples pulled from the spec.
- API pages use a three-column layout, with the documentation on the left and code examples on the right.
- The sidebar mirrors your spec's tags, with color-coded GET, POST, PUT and DELETE badges.
- Parameters and response fields show type, format, constraints, defaults and examples. Nested objects and arrays collapse.
- The
wc-fieldcomponent has a new single-column layout, described in the API reference components page.
The full workflow is in the OpenAPI integration guide.
Save as PDF
A "Save as PDF" button now sits in the page toolbar next to "Copy as Markdown" and "View as Markdown". Print output hides the page chrome, expands accordions and tabs, and avoids page breaks inside code blocks and tables. It works in static builds and the dev server.
Upgrade
Full details are in the changelog. To upgrade, run npm install -g docslit@latest, or use npx docslit@latest.