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 cross_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.8.1.tar.gz
(23.7 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.8.1.tar.gz.
File metadata
- Download URL: cross_docs-0.8.1.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6520daff3f2546cadfb1d0f844ba2b18446700b484976fb2b301998076fc9a4a
|
|
| MD5 |
2d8c72765592b5af79bc43e229c6db5f
|
|
| BLAKE2b-256 |
d11c744a2085829a161bcc3f60ed7f0c378ddd657bce7f6aafb056b7721dd971
|
File details
Details for the file cross_docs-0.8.1-py3-none-any.whl.
File metadata
- Download URL: cross_docs-0.8.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f13d70c6e2ef0ae036aa1ca5c3cad1dbb6c2d8cfb1df3ea1029eee1c365c5a
|
|
| MD5 |
f011b446b7380273c9fa562f86674bc7
|
|
| BLAKE2b-256 |
e2d863aac44222a8de88f7071776f20fde7adb53c1f7b52e2caaf39041117ccb
|