Introduction
Welcome to the documentation. This is a modern, lightweight documentation site built with pure HTML, CSS, and JavaScript. It's designed to be fast, accessible, and easy to navigate.
What is this?
This documentation system provides a clean, developer-friendly interface for technical documentation. It features client-side search, smooth scrolling, responsive design, and syntax highlighting.
Getting Started
To get started, simply include the CSS and JavaScript files in your HTML. The layout uses semantic HTML5 elements and CSS Grid for the structure.
# Clone the repository
git clone https://github.com/example/docs.git
cd docs
# Install dependencies
npm install
# Start development server
npm run dev
Guide
Configuration
The documentation site can be configured through a simple JavaScript object. All customization is done through CSS variables for easy theming.
Basic Configuration
Here's a basic configuration example:
const config = {
title: 'My Documentation',
theme: 'light',
search: {
enabled: true,
placeholder: 'Search...'
},
sidebar: {
collapsible: true,
depth: 3
}
};
// Initialize documentation
initDocs(config);
Advanced Options
For advanced use cases, you can customize the build process, add plugins, and extend the default theme.
| Option | Type | Default | Description |
|---|---|---|---|
base |
string | '/' | Base URL for the documentation |
lang |
string | 'en-US' | Language locale |
smoothScroll |
boolean | true | Enable smooth scrolling |
Navigation Structure
The sidebar navigation is automatically generated from your HTML structure.
Use semantic heading tags (h1, h2, h3)
to create the document outline.
h2 to h4).
API Reference
Core Methods
initDocs(config)
Initializes the documentation system with the provided configuration.
- Parameters:
config- Configuration object - Returns:
DocsInstance
search(query)
Performs a client-side search through all documentation content.
// Search for specific content
const results = search('configuration');
// Returns array of matches
results.forEach(match => {
console.log(match.title, match.content);
});
Components
Code Blocks
Code blocks support syntax highlighting. Wrap code in pre and
code tags:
<pre>
<code>
const x = 10;
console.log(x);
</code>
</pre>
Examples
Basic Example
Here's a complete working example:
<!DOCTYPE html>
<html>
<head>
<title>My Docs</title>
<link rel="stylesheet" href="docs.css">
</head>
<body>
<div class="sidebar">...</div>
<main>...</main>
<script src="docs.js"></script>
</body>
</html>
Customization
You can customize the appearance using CSS variables. Override the defaults in your own stylesheet:
:root {
--primary: #3498db;
--sidebar-width: 300px;
--bg-sidebar: #fafafa;
}