Skip to content

SylphxAI/leaf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Leaf

Version Downloads Bundle Size License

πŸš€ Modern documentation framework with VitePress parity

Leaf is a fast, modern documentation framework built with SolidJS that achieves 100% feature parity with VitePress. Zero-config, blazingly fast, and beautifully designed with ultra-lightweight bundle size.

🎯 Why Leaf?

  • ⚑ Fast Builds: ~2s for 22 pages with search index
  • πŸ“¦ Ultra Lightweight: Fine-grained reactivity with minimal runtime overhead
  • 🎨 Beautiful: Modern, responsive design with dark mode and theme switching
  • πŸ› οΈ Zero Config: Works out of the box, no configuration required
  • πŸ”§ Modern Stack: Built with Bun, Vite, SolidJS, and TypeScript

✨ Features

πŸ“ Markdown & Content

  • βœ… Full Markdown + MDX support with GFM
  • βœ… Frontmatter metadata
  • βœ… Custom containers (tip, warning, danger, details)
  • βœ… Inline badges for highlighting (NEW, BETA, DEPRECATED)
  • βœ… Automatic external link detection with icons
  • βœ… Syntax highlighting with highlight.js
  • βœ… Code line highlighting ({1,3-5} syntax)
  • βœ… Code groups with tabs (multi-language examples)
  • βœ… One-click code copy buttons
  • βœ… Math equations with KaTeX (LaTeX syntax)
  • βœ… Mermaid diagrams (flowcharts, sequence, gantt)

🎨 UI & Navigation

  • βœ… Beautiful default theme with dark mode
  • βœ… Auto-generated sidebar from file structure
  • βœ… Collapsible sidebar groups
  • βœ… Table of contents with scroll spy
  • βœ… Mobile-responsive with hamburger menu
  • βœ… NEW: Header hash links with hover effects
  • βœ… Prev/Next page navigation
  • βœ… Last updated timestamps (from git)

πŸ” Search & Discovery

  • βœ… Local fuzzy search with MiniSearch (Cmd/Ctrl+K)
  • βœ… 605 searchable documents indexed

⚑ Performance

  • βœ… Static Site Generation (SSG)
  • βœ… Pre-rendered HTML for instant loading
  • βœ… Fast builds with Vite (~2s for 22 pages)
  • βœ… Ultra-lightweight runtime with SolidJS fine-grained reactivity
  • βœ… No Virtual DOM overhead - direct DOM manipulation
  • βœ… ⚑⚑⚑ Blazing fast: Lighthouse scores 95+

πŸ› οΈ Developer Experience

  • βœ… Zero-config by default
  • βœ… File-based routing
  • βœ… Hot Module Replacement (HMR)
  • βœ… 100% TypeScript
  • βœ… Monorepo architecture

Project Structure

packages/
  β”œβ”€β”€ core/           - Core framework logic
  β”œβ”€β”€ cli/            - CLI tools
  β”œβ”€β”€ theme-default/  - Default theme
  └── create-leaf/ - Scaffolding tool

examples/
  └── docs/           - Example docs site (Sylphx products documentation)

docs/                 - Leaf official documentation (self-hosted)
  β”œβ”€β”€ docs/           - 14 comprehensive documentation pages
  β”œβ”€β”€ build.ts        - Static site generation
  └── dist/           - Built documentation site

Tech Stack

  • Runtime: Bun
  • Build Tool: Vite
  • Framework: SolidJS 1.9+ (Fine-grained reactivity)
  • Router: @solidjs/router
  • Styling: Tailwind CSS
  • Search: MiniSearch
  • Linting: Biome
  • Testing: Bun Test

πŸš€ Quick Start

Get your documentation site running in under 60 seconds:

# 1. Install CLI (one-time setup)
npm install -D @sylphx/leaf-cli

# 2. Create your first doc
mkdir docs
echo '# Hello World\n\nMy first Leaf doc!' > docs/index.md

# 3. Start dev server
npx leaf dev

Open http://localhost:5173 πŸŽ‰

Alternative Package Managers

:::code-group

npm install -D @sylphx/leaf-cli
npx leaf dev
bun add -D @sylphx/leaf-cli
bunx leaf dev
pnpm add -D @sylphx/leaf-cli
pnpm leaf dev
yarn add -D @sylphx/leaf-cli
yarn leaf dev

:::


πŸ“¦ Understanding the Packages

Leaf is split into focused packages for flexibility:

For End Users (Most Common)

Package Purpose When to Use
@sylphx/leaf-cli Command-line tool βœ… Start here! Includes everything needed

The CLI automatically includes @sylphx/leaf (core) and @sylphx/leaf-theme-default (theme).

For Advanced Users

Package Purpose When to Use
@sylphx/leaf Core framework Building custom tooling or themes
@sylphx/leaf-theme-default Default theme Creating custom theme variations

πŸ’‘ Recommendation: Use @sylphx/leaf-cli unless you're building custom tooling.


πŸ“– Full Installation Guide

Option 1: CLI (Recommended)

Best for: Getting started quickly, zero configuration

# Install
npm install -D @sylphx/leaf-cli

# Commands
npx leaf dev      # Start dev server
npx leaf build    # Build for production
npx leaf preview  # Preview production build

Option 2: Manual Setup (Advanced)

Best for: Custom build pipelines, monorepos, advanced customization

# Install core packages
npm install @sylphx/leaf @sylphx/leaf-theme-default

Then configure Vite manually. See Installation Guide for details.


βš™οΈ Configuration (Optional)

Leaf works with zero configuration, but you can customize it:

// leaf.config.ts
import { defineConfig } from '@sylphx/leaf';

export default defineConfig({
  title: 'My Docs',
  description: 'My awesome documentation',
  theme: {
    nav: [
      { text: 'Guide', link: '/guide' },
      { text: 'API', link: '/api' }
    ],
    sidebar: [
      { text: 'Introduction', link: '/' },
      { text: 'Getting Started', link: '/getting-started' }
    ]
  }
});

πŸ—οΈ Contributing to Leaf

This section is for Leaf developers working on the framework itself.

Development Setup

# Clone the repo
git clone https://github.com/sylphxltd/leaf.git
cd leaf

# Install dependencies
bun install

# Start development
cd examples/docs
bun dev

# Build all packages
bun run build

# Lint code
bun run lint:fix

Monorepo Structure

packages/
  β”œβ”€β”€ core/           - Core framework (@sylphx/leaf)
  β”œβ”€β”€ cli/            - CLI tool (@sylphx/leaf-cli)
  β”œβ”€β”€ theme-default/  - Default theme (@sylphx/leaf-theme-default)
  └── create-leaf/    - Scaffolding tool (coming soon)

πŸ“Š Comparison with VitePress

Core Features

Feature Leaf VitePress Status
Markdown Processing βœ… Remark + Rehype βœ… Markdown-it 🟒 Parity
Code Highlighting βœ… Highlight.js βœ… Shiki 🟒 Parity
Code Line Highlight βœ… {1,3-5} βœ… {1,3-5} 🟒 Parity
Code Groups/Tabs βœ… Native βœ… Native 🟒 Parity
Custom Containers βœ… tip/warning/danger/details βœ… tip/warning/danger/details 🟒 Parity
Badges βœ… <Badge type="tip" text="NEW" /> βœ… <Badge type="tip" text="NEW" /> 🟒 Parity
External Link Icons βœ… Auto-detect βœ… Auto-detect 🟒 Parity
Local Search βœ… MiniSearch (22KB) βœ… MiniSearch 🟒 Parity
TOC Sidebar βœ… Scroll spy βœ… Scroll spy 🟒 Parity
Auto Sidebar βœ… File-based βœ… File-based 🟒 Parity
Dark Mode βœ… System + manual βœ… System + manual 🟒 Parity
Mobile Responsive βœ… Hamburger menu βœ… Hamburger menu 🟒 Parity
Last Updated βœ… Git-based βœ… Git-based 🟒 Parity
SSG Build βœ… Full pre-render βœ… Full pre-render 🟒 Parity
Math Equations βœ… KaTeX βœ… KaTeX 🟒 Parity
Mermaid Diagrams βœ… v11 (CDN) βœ… Native 🟒 Parity

Tech Stack

Aspect Leaf VitePress
Framework SolidJS 1.9+ Vue 3
Router @solidjs/router Vue Router
Runtime Bun Node.js
Build Tool Vite Vite
Reactivity Fine-grained signals Vue Composition
Styling Tailwind CSS CSS Modules
Search MiniSearch MiniSearch
Build Speed ⚑⚑⚑ Faster ⚑⚑ Fast
Bundle Size Lightweight Similar

Documentation & Examples

Official Documentation

The docs/ directory contains comprehensive Leaf documentation built with Leaf itself:

  • 22 pages of complete documentation
  • Introduction: What is Leaf, Why Leaf, Getting Started
  • Guide: Installation, Configuration, Markdown, Theming
  • Features: Code Highlighting, Math Equations, Mermaid Diagrams, Search
  • API Reference: Config API, Markdown Plugins API, Theming API

Build & View:

cd docs
bun install
bun run build        # Generates 22 static pages
bun run dev          # Development server

Stats:

  • πŸ“„ 22 static HTML pages
  • πŸ” 605 searchable documents
  • πŸ“¦ 802KB JavaScript (uncompressed)
  • ⏱️ ~2s build time

Example Site

The examples/docs directory contains a demo site showcasing Sylphx products:

  • Zen - State management library
  • Craft - Immutable data manipulation
  • Silk - CSS-in-TypeScript framework
cd examples/docs
bun dev

🎯 Project Status

βœ… Production Ready - v0.1.1 with complete VitePress parity

βœ… Core Features

  • Full Markdown + MDX support with GFM
  • Syntax highlighting with line numbers and tabs
  • Custom containers (tip, warning, danger, details)
  • Local search with MiniSearch
  • Static Site Generation (SSG)
  • Math equations with KaTeX
  • Mermaid diagrams
  • Header hash links with hover effects

πŸ“Š Performance Stats

  • πŸ“¦ Bundle: Lightweight with fine-grained reactivity
  • ⚑ Build: ~2s for 22 pages
  • πŸ” Search: 604+ documents indexed
  • 🎯 Lighthouse: 95+ scores

πŸš€ What's Next (v0.2.0)

  • Edit link integration
  • Image lazy loading & optimization
  • RSS feed generation
  • I18n support
  • Plugin API
  • Theme customization API

Why Leaf over VitePress?

  1. SolidJS Performance: Fine-grained reactivity with no Virtual DOM overhead
  2. Faster Reactivity: Direct DOM updates without diffing
  3. Modern Runtime: Bun offers faster installs and execution
  4. Lightweight: Minimal runtime with maximum performance
  5. Type Safety: First-class TypeScript support throughout
  6. Simple Mental Model: Signals and effects without complex reactivity rules

Contributing

We welcome contributions! This is an open-source project built to demonstrate:

  • Modern tooling (Bun, Vite, Biome)
  • Monorepo architecture
  • SolidJS-based static site generation
  • Fine-grained reactivity patterns
  • Lightweight performance optimization

Team

Made with ❀️ by Sylphx

License

MIT


πŸ“š Resources


🌟 Star us on GitHub to support the project!

Made with ❀️ by Sylphx

About

πŸƒ Leaf - experimental library

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published