|
1 | 1 | # Docsmith |
2 | 2 |
|
3 | | -Docsmith is a small PHP package for turning Markdown files into a static documentation site. |
4 | | - |
5 | | -## Current capabilities |
6 | | - |
7 | | -- Build a multi-page documentation site from a Markdown directory. |
8 | | -- Generate one HTML page per Markdown file. |
9 | | -- Publish local CSS assets into the output directory. |
10 | | -- Publish local JS assets for search, theme toggle, and code-copy UX. |
11 | | -- Support both a static entry point and a fluent builder API. |
12 | | -- Build sites from the command line via the bundled `bin/docsmith` binary. |
13 | | -- Render Markdown through League CommonMark with GitHub-flavored extensions. |
14 | | -- Parse frontmatter metadata (`title`, `description`, `slug`, `order`, `sidebar_label`, `hidden`). |
15 | | -- Hide pages from navigation, search, and pagination via frontmatter `hidden: true`. |
16 | | -- Generate `search-index.json`, `sitemap.xml`, and `.nojekyll`. |
17 | | -- Support repository/edit links and previous/next page navigation. |
18 | | -- Build multiple versions of one documentation set with pill buttons on every page. |
19 | | -- Assemble a docs hub of independent documentation sets with a sidebar dropdown. |
20 | | -- Sync Markdown from remote Git repositories via smart HTTPS (no git binary, no clones). |
21 | | -- Search overlay with `Cmd+K` / `Ctrl+K` keyboard shortcut. |
22 | | -- AI-consumable export: `llms.txt`, `llms-full.txt`, `export/docs.md`. |
23 | | -- Open Graph / Twitter card tags and generated social preview images. |
24 | | -- Sidebar "Built with DocSmith" attribution that can be disabled per build. |
25 | | -- Validate the package with Pest, PHPStan, Rector, and Pint. |
26 | | - |
27 | | -## Current status |
28 | | - |
29 | | -Docsmith is actively used to generate documentation for multiple packages and supports static-hosting workflows out of the box. |
30 | | - |
31 | | -Search includes both: |
32 | | - |
33 | | -- sidebar link filtering |
34 | | -- global index search powered by generated `search-index.json` |
35 | | -- overlay modal with keyboard shortcut |
36 | | - |
37 | | -## Documentation pages |
38 | | - |
39 | | -- Installation |
40 | | -- Usage |
41 | | -- Architecture |
42 | | -- Development |
43 | | -- Versioned Docs |
44 | | -- Docs Hub |
45 | | -- Remote Sources |
46 | | -- Workflows |
47 | | -- LLM Export |
48 | | -- Open Graph |
| 3 | +Docsmith is a PHP package that turns a directory of Markdown files into a static documentation site. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Builds one HTML page per Markdown file into a self-contained output directory. |
| 8 | +- Sidebar navigation with grouping, active page highlighting, and a filter box. |
| 9 | +- Global search backed by a generated `search-index.json`, plus a `Cmd+K` / `Ctrl+K` search overlay. |
| 10 | +- Dark mode, syntax-highlighted code blocks, and a copy button on snippets. |
| 11 | +- Frontmatter support for `title`, `description`, `slug`, `order`, `sidebar_label`, and `hidden`. |
| 12 | +- Versioned docs with pill buttons to switch versions. |
| 13 | +- Docs hub that combines several independent documentation sets under one sidebar dropdown. |
| 14 | +- Remote source syncing that pulls Markdown from any Git host over plain HTTPS, no `git` binary needed. |
| 15 | +- Generated `search-index.json`, `sitemap.xml`, `.nojekyll`, and favicon on every build. |
| 16 | +- Text exports for LLMs: `llms.txt`, `llms-full.txt`, and `export/docs.md`. |
| 17 | +- Open Graph and Twitter card tags with optional generated preview images. |
| 18 | +- Edit links, previous/next navigation, and a right sidebar table of contents. |
| 19 | +- Three ways to run it: a static API, a fluent builder, and a `vendor/bin/docsmith` CLI. |
| 20 | + |
| 21 | +## Requirements |
| 22 | + |
| 23 | +- PHP 8.3 or newer |
| 24 | +- Composer |
| 25 | + |
| 26 | +No framework is required. Docsmith has no Laravel or Illuminate dependency. |
| 27 | + |
| 28 | +## Quick start |
| 29 | + |
| 30 | +```bash |
| 31 | +composer require --dev mrpunyapal/docsmith |
| 32 | +``` |
| 33 | + |
| 34 | +```php |
| 35 | +use Docsmith\Docsmith; |
| 36 | + |
| 37 | +Docsmith::build( |
| 38 | + source: __DIR__ . '/md', |
| 39 | + title: 'Project Docs', |
| 40 | +); |
| 41 | +``` |
| 42 | + |
| 43 | +This reads Markdown from `md/` and writes the site to `docs/` by default, which works directly with GitHub Pages. |
| 44 | + |
| 45 | +## Documentation |
| 46 | + |
| 47 | +- [Installation](installation.md) |
| 48 | +- [Usage](usage.md) |
| 49 | +- [Versioned Docs](versioned-docs.md) |
| 50 | +- [Docs Hub](docs-hub.md) |
| 51 | +- [Remote Sources](remote-sources.md) |
| 52 | +- [Workflows](workflows.md) |
| 53 | +- [LLM Export](llm-export.md) |
| 54 | +- [Open Graph Images](open-graph.md) |
| 55 | +- [Architecture](architecture.md) |
| 56 | +- [Development](development.md) |
| 57 | + |
| 58 | +## License |
| 59 | + |
| 60 | +MIT. See [LICENSE](https://github.com/MrPunyapal/docsmith/blob/main/LICENSE) for details. |
0 commit comments