From c935ddf93002bf713c619221e2cd5d94ba9561ac Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Wed, 2 Dec 2026 00:54:10 +0100 Subject: [PATCH] docs: the fork's documentation as a website, tth-pub.pages.rfa.cz/meshcore-tth Co-Authored-By: Claude Opus 5.5 --- .github/docs-site.sh | 63 +++++++++++++++++++++++ .github/workflows/github-pages.yml | 3 ++ .github/workflows/tth-docs.yml | 82 ++++++++++++++++++++++++++++++ README.md | 6 +++ docs/_stylesheets/tth.css | 36 +++++++++++++ mkdocs.tth.yml | 61 ++++++++++++++++++++++ 6 files changed, 251 insertions(+) create mode 100644 .github/docs-site.sh create mode 100644 .github/workflows/tth-docs.yml create mode 100644 docs/_stylesheets/tth.css create mode 100644 mkdocs.tth.yml diff --git a/.github/docs-site.sh b/.github/docs-site.sh new file mode 100644 index 00000000..87a645e1 --- /dev/null +++ b/.github/docs-site.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# The docs website of this fork (https://tth-pub.pages.rfa.cz/meshcore-tth/): +# mkdocs (theme mkdocs-terminal) over docs/, in English: the English half of +# the fork's README is the home page, the Czech half one page (cs.md); the +# fork's own docs first, upstream's below. +# +# Usage: .github/docs-site.sh (run from the repo root) +# Needs mkdocs-terminal and markdown-callouts, e.g. +# uvx --with mkdocs-terminal --with markdown-callouts mkdocs --version +# The script stages a copy of docs/ (README split into index.md / cs.md, +# links that leave docs/ pointed at the repo) and builds it with +# mkdocs.tth.yml. Upstream's mkdocs.yml (Material) stays as it is (no +# conflicts in upstream-sync merges). +# Build only from the PUBLIC tree (tth-pub): the export leaves our operations +# docs out, a build of the private repo would publish them. +set -euo pipefail +case "${1:-}" in -h | --help | "") + sed -n '2,/^[^#]/{/^#/s/^# \{0,1\}//p}' "$0" + [ -n "${1:-}" ] || exit 2 + exit 0 + ;; +esac +out=$(realpath -m "$1") +repo=https://git.rfa.cz/tth-pub/meshcore-tth +src="$repo/src/branch/main" +stage=$(mktemp -d) +trap 'rm -rf "$stage"' EXIT + +cp -r docs "$stage/docs" +# upstream's own introduction gets a page of its own; ours is the home page +mv "$stage/docs/index.md" "$stage/docs/meshcore.md" +rm -f "$stage/docs/docs.md" # how to build upstream's site, not for readers + +# README of the fork: "## O tomto forku" .. "## About this fork" = Czech, +# from there to "## About MeshCore" = English. One heading level up, links +# into docs/ made site-relative, any other repo path absolute. +readme_part() { + sed -n "/^## $1/,/^## $2/p" README.md | sed '$d' | + sed -E 's/^#(#+) /\1 /' | + sed -E 's#\]\((\./)?docs/([^)]+)\)#](\2)#g' | + sed -E "s#\\]\\((\\./)?([a-zA-Z][^):]*)\\)#](${src//#/\\#}/\\2)#g" +} +readme_part 'About this fork' 'About MeshCore' >"$stage/docs/index.md" +readme_part 'O tomto forku' 'About this fork' >"$stage/docs/cs.md" +if ! grep -q . "$stage/docs/index.md" || ! grep -q . "$stage/docs/cs.md"; then + echo "docs-site: README sections not found (headings changed?)" >&2 + exit 1 +fi +# the two languages link to each other by anchor, and "above"/"below" +# is a separate page here +sed -i -E 's#Česká verze \[výše\]#[Česká verze]#' "$stage/docs/index.md" +sed -i -E 's#English version \[below\]#[English version]#' "$stage/docs/cs.md" +sed -i -E 's#\]\(\#about-this-fork[^)]*\)#](index.md)#g' "$stage/docs/cs.md" +sed -i -E 's#\]\(\#o-tomto-forku[^)]*\)#](cs.md)#g' "$stage/docs/index.md" +# GFM (Gitea) needs `\|` for a pipe in code inside a table cell; Python- +# Markdown keeps the backslash and does not split cells on a pipe in code +perl -0pi -e 's/(`[^`\n]*`)/ (my $c = $1) =~ s#\\\|#|#g; $c /ge' "$stage"/docs/*.md +# our docs link back to ../README.md +sed -i -E 's#\]\(\.\./README\.md#](index.md#g' "$stage"/docs/*.md + +cp mkdocs.tth.yml "$stage/" +cd "$stage" +mkdocs build --strict -f mkdocs.tth.yml -d "$out" diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index b01ddc93..92dd8850 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -11,6 +11,9 @@ permissions: jobs: github-pages: + # CUSTOM (TeTeHacko): upstream's site only; this fork publishes its own + # (tth-docs.yml), and here the job only filled an unread gh-pages branch + if: github.repository == 'meshcore-dev/MeshCore' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/tth-docs.yml b/.github/workflows/tth-docs.yml new file mode 100644 index 00000000..fb872875 --- /dev/null +++ b/.github/workflows/tth-docs.yml @@ -0,0 +1,82 @@ +# Docs website of this fork: https://tth-pub.pages.rfa.cz/meshcore-tth/ +# +# Runs only in the published repo (tth-pub/meshcore-tth), after a push to main +# that touches the docs: .github/docs-site.sh builds the site (mkdocs, theme +# mkdocs-terminal, mkdocs.tth.yml) from the public tree -- the export leaves +# our operations docs out, so nothing private can end up on it -- and the +# result is force-pushed as the only commit of the branch `pages`. A webhook +# of the repo (push, branch filter `pages`) tells git-pages on pages.rfa.cz, +# which clones the branch anonymously: no token outside this repo's own. +# git-pages: roles/git_pages in the proxmox.rfa.cz repo. +name: tth-docs + +"on": + push: + branches: [main] + paths: + - "docs/**" + - "README.md" + - "mkdocs.tth.yml" + - ".github/docs-site.sh" + - ".github/workflows/tth-docs.yml" + workflow_dispatch: + +concurrency: + group: tth-docs + cancel-in-progress: true + +permissions: + contents: write + +env: + MKDOCS_VERSION: "1.6.1" + MKDOCS_TERMINAL_VERSION: "4.8.0" + MARKDOWN_CALLOUTS_VERSION: "0.4.0" + PYMDOWN_EXTENSIONS_VERSION: "13.1.2" + +jobs: + site: + if: github.repository == 'tth-pub/meshcore-tth' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # No actions/setup-python: its builds need x86-64-v3, the runner has v2 + # (see tth-tools-lint.yml). mkdocs goes into a venv of the image's python3. + - name: Install mkdocs + run: | + set -euo pipefail + SUDO="$(command -v sudo || true)" + if ! python3 -m venv "$RUNNER_TEMP/docs"; then + $SUDO apt-get update -qq + $SUDO apt-get install -y -qq python3 python3-venv + python3 -m venv --clear "$RUNNER_TEMP/docs" + fi + "$RUNNER_TEMP/docs/bin/pip" install --quiet \ + "mkdocs==$MKDOCS_VERSION" "mkdocs-terminal==$MKDOCS_TERMINAL_VERSION" \ + "markdown-callouts==$MARKDOWN_CALLOUTS_VERSION" \ + "pymdown-extensions==$PYMDOWN_EXTENSIONS_VERSION" + echo "$RUNNER_TEMP/docs/bin" >>"$GITHUB_PATH" + + - name: Build + env: + NO_MKDOCS_2_WARNING: "1" + run: bash .github/docs-site.sh "$RUNNER_TEMP/site" + + # A worktree shares the checkout's credentials (github.token); the + # branch keeps one commit, the site of the newest main. + - name: Publish to the pages branch + run: | + set -euo pipefail + git config --global user.name "tth-docs" + git config --global user.email "tth-docs@localhost" + wt="$RUNNER_TEMP/pages" + git worktree add -q --detach "$wt" + cd "$wt" + git checkout -q --orphan pages-build + git rm -rqf . + cp -r "$RUNNER_TEMP/site/." . + git add -A + git commit -q -m "docs site from main ${GITHUB_SHA:0:8}" + git push -q -f origin HEAD:refs/heads/pages + echo "published ${GITHUB_SHA:0:8} to pages" diff --git a/README.md b/README.md index 4a1a04db..ab664502 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ meshi (869,432 MHz). Upstreamové větve `main` a `dev` se slučují automaticky dvakrát denně; všechno níže je navíc nad nimi. Náš kód je ve zdrojácích označený `CUSTOM (TeTeHacko)`. Nic z toho nemění protokol na rádiu. +Dokumentace forku i upstreamu jako web (anglicky, tahle část česky): +https://tth-pub.pages.rfa.cz/meshcore-tth/ + ### Repeater: antispam (všechno vypínatelné, nic z toho není v upstreamu) **Po nahrání je zapnutý jen FairnessLimiter**, s limity se zhruba @@ -343,6 +346,9 @@ the CZ mesh (869.432 MHz). Upstream `main` and `dev` are merged automatically twice a day; everything below is on top of that. Our code is marked `CUSTOM (TeTeHacko)` in the source. Nothing here changes the wire protocol. +The fork's and upstream's docs as a website: +https://tth-pub.pages.rfa.cz/meshcore-tth/ + ### Repeater: antispam (all of it off-switchable, none of it upstream) **After flashing only the FairnessLimiter is on**, with limits about twice diff --git a/docs/_stylesheets/tth.css b/docs/_stylesheets/tth.css new file mode 100644 index 00000000..0a049724 --- /dev/null +++ b/docs/_stylesheets/tth.css @@ -0,0 +1,36 @@ +/* Docs site of the meshcore-tth fork (mkdocs.tth.yml, theme mkdocs-terminal, + palette "dark"): only what the palette lacks. Green instead of its blue, + and the GitHub callouts (> [!WARNING]) the theme does not style. */ +:root { + --primary-color: #5fd38d; + --progress-bar-fill: #5fd38d; + /* plain black; the palette's 60em column was a thin noodle on a wide + screen (user, 2. 12. 2026) */ + --background-color: #000; + --invert-font-color: #000; + --code-bg-color: #161616; + --page-width: min(110em, 94vw); +} + +.admonition { + border: 1px solid var(--secondary-color); + padding: 0.2em 1em; + margin: var(--global-line-height) 0; +} +.admonition-title { + font-weight: bold; + margin: 0.4em 0 0; +} +.admonition.warning, .admonition.caution, .admonition.danger { + border-color: #e5a50a; +} +.admonition.warning > .admonition-title, +.admonition.caution > .admonition-title, +.admonition.danger > .admonition-title { + color: #e5a50a; +} +.admonition.note > .admonition-title, +.admonition.tip > .admonition-title, +.admonition.important > .admonition-title { + color: var(--primary-color); +} diff --git a/mkdocs.tth.yml b/mkdocs.tth.yml new file mode 100644 index 00000000..a11f9df7 --- /dev/null +++ b/mkdocs.tth.yml @@ -0,0 +1,61 @@ +# Docs website of this fork (https://tth-pub.pages.rfa.cz/meshcore-tth/), +# built by .github/docs-site.sh. Its own file, not an INHERIT of upstream's +# mkdocs.yml (that one is Material: logo, features, palette): theme +# mkdocs-terminal, palette "dark" with docs/_stylesheets/tth.css on top. +site_name: MeshCore TTH +site_url: https://tth-pub.pages.rfa.cz/meshcore-tth/ +site_description: MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults +repo_name: tth-pub/meshcore-tth +repo_url: https://git.rfa.cz/tth-pub/meshcore-tth +edit_uri: src/branch/main/docs/ + +theme: + name: terminal + palette: dark + features: + # no blinking cursor after the site name (user, 2. 12. 2026) + - navigation.top.cursor_animation.hide + - navigation.side.indexes + +extra_css: + - _stylesheets/tth.css + +plugins: + - search + +markdown_extensions: + - admonition + - github-callouts + - attr_list + - tables + - toc + - pymdownx.details + - pymdownx.superfences + +# One language for the site: English (every doc in docs/ is English); the +# Czech half of the README is one page, "Česky", in the top bar. Titles in +# both languages side by side were confusing (user, 2. 12. 2026). +nav: + - About the fork: index.md + - Česky: cs.md + - Fork meshcore-tth: + - Console commands: tth-commands.md + - Firmware update by the admin (OTA): ota.md + - Power saving: power.md + - Budka as a sensor: budka-sensor.md + - BLE/LoRa coexistence: ble-lora-coexistence.md + - MeshCore (upstream): + - Introduction: meshcore.md + - FAQ: faq.md + - CLI commands: cli_commands.md + - Companion CLI: companion_cli.md + - Companion protocol: companion_protocol.md + - Terminal chat CLI: terminal_chat_cli.md + - KISS modem protocol: kiss_modem_protocol.md + - Packet format: packet_format.md + - Payloads: payloads.md + - Stats binary frames: stats_binary_frames.md + - Number allocations: number_allocations.md + - QR codes: qr_codes.md + - Radio presets: radio_presets.md + - nRF52 power management: nrf52_power_management.md