Documentation framework built on Cross-Inertia
Project description
cross-docs
Python backend utilities for Cross-Docs documentation framework.
Installation
uv add cross-docs
# or
pip install cross-docs
Usage
from pathlib import Path
from fastapi import FastAPI, Request
from cross_docs import (
generate_nav,
create_docs_handler,
strip_trailing_slash_middleware,
)
from inertia.fastapi import InertiaDep
app = FastAPI()
app.middleware("http")(strip_trailing_slash_middleware)
CONTENT_DIR = Path("content")
NAV = generate_nav(CONTENT_DIR / "docs")
docs_handler = create_docs_handler(CONTENT_DIR, NAV)
@app.get("/docs")
async def docs_index(request: Request, inertia: InertiaDep):
return await docs_handler(request, inertia)
@app.get("/docs/{path:path}")
async def docs_page(path: str, request: Request, inertia: InertiaDep):
return await docs_handler(request, inertia, path=path)
API
Markdown Utilities
parse_frontmatter(content: str)- Parse YAML frontmatterload_markdown(content_dir: Path, path: str)- Load and parse markdownload_raw_markdown(content_dir: Path, path: str)- Load raw markdown
Navigation
generate_nav(docs_dir, base_path, section_order, index_page)- Generate nav from files
Middleware
strip_trailing_slash_middleware- Redirect trailing slasheswants_markdown(request)- Check Accept header for markdown
Routes
create_docs_handler(...)- Create a docs route handler
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cross_docs-0.1.0.tar.gz
(22.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cross_docs-0.1.0.tar.gz.
File metadata
- Download URL: cross_docs-0.1.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ab83924272c8d00b23ddcd12a4455375adfb9be8e539c531dfa5d79a6c1d2c8
|
|
| MD5 |
3f025f15d880d6c94c41f83acedf240d
|
|
| BLAKE2b-256 |
2009b8af15552b43e92e1b3b51be3019975b8095302a0719bee1e503bcf3439e
|
File details
Details for the file cross_docs-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cross_docs-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
016d5a15524a367baa8139292f5df4c5593a54faaddf5eab495c8bd425df72a7
|
|
| MD5 |
261c8fadee2af38e7a68089379742ade
|
|
| BLAKE2b-256 |
4819ff3d443423c1463b13678e31a1d268d69a78ebe4536470067796efc6edae
|