Skip to main content

Fetch collaborative documents from a Docs instance and generate static sites with Zensical

Project description

Docs2Static

Transforme des documents collaboratifs Docs en site statique avec Zensical. Homepage stylisee incluse.

Exemple : Document source -> Site genere

Installation

# Avec pip
pip install docs2static

# Avec uv
uv add docs2static

# Depuis les sources
git clone git@github.com:CoopCodeCommun/Docs2static.git
cd Docs2static
uv sync

Requiert Python 3.14+.

Configuration

cp env_example .env

Variables dans le .env :

Variable Description
DOCS_URL URL du document Docs racine
GITHUB_REPO Adresse SSH du depot GitHub (ex: git@github.com:User/Repo.git)
GITLAB_REPO Adresse SSH du depot GitLab (alternative)
BACKEND Moteur statique (par defaut : zensical)

Usage CLI

# Telecharger les documents et construire le site
docs2static

# Deployer sur GitHub/GitLab Pages (sans retelecharger)
docs2static --deploy

# Forcer le telechargement sans cache
docs2static --no-cache

# Specifier le format de sortie
docs2static -f html        # html, markdown ou both

Options

Option Description
-f, --format Format de sortie (html, markdown, both)
--no-cache Ignorer le cache SQLite (24h par defaut)
-b, --backend Moteur de site statique
-d, --deploy Deployer sans retelecharger

Metadonnees (frontmatter)

Ajoutez un bloc frontmatter au debut de vos documents Docs :

---
titre: Ma page
auteur·ice: Jonas
brouillon: non
resume: Description de la page
date: 2026-01-15
---
Cle (FR / EN) Usage
titre / title Titre de la page
auteur·ice / author Auteur du site (copyright)
resume / summary Description du site ou extrait
licence / license Licence affichee dans le copyright
brouillon / draft oui / true = page et enfants ignores
date Date du document (AAAA-MM-JJ)

Deploiement en production

GitHub Actions

Creez .github/workflows/docs2static.yml :

name: Build & Deploy Documentation

on:
  schedule:
    - cron: '0 6 * * *'   # Tous les jours a 6h
  workflow_dispatch:        # Lancement manuel

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install uv
        uses: astral-sh/setup-uv@v4

      - name: Setup Python
        run: uv python install 3.14

      - name: Install docs2static
        run: uv add docs2static

      - name: Build & Deploy
        env:
          DOCS_URL: ${{ secrets.DOCS_URL }}
          GITHUB_REPO: ${{ secrets.GITHUB_REPO }}
          BACKEND: zensical
        run: |
          uv run docs2static
          uv run docs2static --deploy

Ajoutez les secrets DOCS_URL et GITHUB_REPO dans les parametres du depot. Configurez une cle SSH de deploiement avec acces en ecriture au depot cible.

GitLab CI

Creez .gitlab-ci.yml :

pages:
  image: python:3.14
  stage: deploy
  script:
    - pip install uv
    - uv add docs2static
    - uv run docs2static
    - uv run docs2static --deploy
  variables:
    DOCS_URL: $DOCS_URL
    GITLAB_REPO: $GITLAB_REPO
    BACKEND: zensical
  only:
    - schedules
    - web

Ajoutez les variables DOCS_URL et GITLAB_REPO dans CI/CD > Variables.

Deploiement manuel (serveur)

# Installation
pip install docs2static

# Configuration
export DOCS_URL="https://notes.liiib.re/docs/votre-doc-id/"
export GITHUB_REPO="git@github.com:Org/Repo.git"
export BACKEND="zensical"

# Execution
docs2static              # Telecharge + build
docs2static --deploy     # Deploie sur Pages

# Cron (optionnel)
echo "0 6 * * * cd /opt/docs && docs2static && docs2static --deploy" | crontab -

Architecture

docs2static/
  main.py                # Orchestration : API, arbre, frontmatter, images
  zensical_backend.py    # Integration Zensical : navigation, toml, deploiement
  assets/                # Template homepage + CSS embarques

Pipeline : Docs API -> arbre -> frontmatter -> images -> Markdown -> Zensical build -> deploy

Pour plus de details, voir guideline.md.

Tests

uv run python -m pytest tests/

# Avec options
uv run python tests/test_main.py --no-cache     # Sans cache
uv run python tests/test_main.py --deploy        # Test deploiement reel
uv run python tests/test_main.py --test-zensical # Test rendu interactif

Licence

Apache 2.0 - Voir LICENSE.

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docs2static-0.1.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docs2static-0.1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file docs2static-0.1.0.tar.gz.

File metadata

  • Download URL: docs2static-0.1.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"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":null}

File hashes

Hashes for docs2static-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5756e2ffde912afe95f88c6215dd15543b99d259ab1d6eefc338338767f95558
MD5 a915b6899030345b3fab9f068b941c1a
BLAKE2b-256 1b60c820f043eca4f700aa88d622ddb32821364ffcbf9d488722405ed11b892f

See more details on using hashes here.

File details

Details for the file docs2static-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: docs2static-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"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":null}

File hashes

Hashes for docs2static-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e54ea2720bce8913fc966da4eec3429b38ac0eff69ab1b6e91331a5617db514e
MD5 0a11c558c48e995b45fa04686ff77fd6
BLAKE2b-256 01a39ec4658e128ca2c2ecd39269ea72693e1161054edf00a22a59b2f0ad7cf3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page