Enforce unique doc filenames and simple wiki-links #109
30 changed files with 101 additions and 70 deletions
Reject wiki-links with spaces and fix existing ones
Update doc-links task to detect and reject wiki-links that have spaces in the target or around the pipe separator. Fix all 60 existing links that had spaces (e.g., [[target | Text]] → [[target|Text]]). This ensures compatibility with obsidian.nvim which doesn't handle spaced wiki-links correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
commit
c7a51ae253
|
|
@ -1 +1 @@
|
|||
Enforce unique filenames and simple wiki-links across all documentation for better obsidian.nvim compatibility
|
||||
Enforce unique filenames, simple wiki-links (no paths), and no spaces in wiki-link targets for obsidian.nvim compatibility
|
||||
|
|
|
|||
|
|
@ -24,4 +24,4 @@ Managed via `Brewfile` and `mise.toml` in the blumeops repo.
|
|||
## Related
|
||||
|
||||
- [[indri]] - Server accessed from gilbert
|
||||
- [[cluster | Cluster]] - Remote k8s access
|
||||
- [[cluster|Cluster]] - Remote k8s access
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ All devices connected via [Tailscale](https://login.tailscale.com/) tailnet `tai
|
|||
|
||||
| Host | Description | Card |
|
||||
|------|-------------|------|
|
||||
| **Indri** | Mac Mini M1, 2020 - Primary server | [[indri | Details]] |
|
||||
| **Gilbert** | MacBook Air M4, 2025 - Workstation | [[gilbert | Details]] |
|
||||
| **[[sifaka | Sifaka]]** | Synology NAS - Storage & backups | [[sifaka | Details]] |
|
||||
| **Indri** | Mac Mini M1, 2020 - Primary server | [[indri|Details]] |
|
||||
| **Gilbert** | MacBook Air M4, 2025 - Workstation | [[gilbert|Details]] |
|
||||
| **[[sifaka|Sifaka]]** | Synology NAS - Storage & backups | [[sifaka|Details]] |
|
||||
| **Mouse** | MacBook Air M2 - Allison's laptop | - |
|
||||
| **UniFi** | UniFi Express 7 - Home WiFi | - |
|
||||
| **Dwarf** | iPad Air - Employer-provided, off tailnet | - |
|
||||
|
|
@ -22,4 +22,4 @@ All devices connected via [Tailscale](https://login.tailscale.com/) tailnet `tai
|
|||
## Related
|
||||
|
||||
- [[tailscale]] - Network configuration
|
||||
- [[routing | Routing]] - Service URLs
|
||||
- [[routing|Routing]] - Service URLs
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@ Primary BlumeOps server. Mac Mini M1 (2020).
|
|||
- [[zot]] - Container registry
|
||||
- [[jellyfin]] - Media server
|
||||
- [[borgmatic]] - Backup system
|
||||
- [[alloy | Alloy]] - Metrics/logs collector
|
||||
- [[alloy|Alloy]] - Metrics/logs collector
|
||||
- [[caddy]] - Reverse proxy for `*.ops.eblu.me`
|
||||
|
||||
**Kubernetes (via minikube):**
|
||||
- [[apps | All k8s applications]]
|
||||
- [[apps|All k8s applications]]
|
||||
|
||||
**GUI Applications (manual start required):**
|
||||
- Docker Desktop - Container runtime for minikube
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ DNS points to indri's Tailscale IP (100.98.163.89). TLS via Let's Encrypt (ACME
|
|||
| [[navidrome]] | https://dj.ops.eblu.me | Music streaming |
|
||||
| [[jellyfin]] | https://jellyfin.ops.eblu.me | Media server |
|
||||
| [[postgresql]] | pg.ops.eblu.me:5432 | Database |
|
||||
| [[sifaka | Sifaka]] | https://nas.ops.eblu.me | NAS dashboard |
|
||||
| [[sifaka|Sifaka]] | https://nas.ops.eblu.me | NAS dashboard |
|
||||
|
||||
## Tailscale-Only Services
|
||||
|
||||
|
|
|
|||
|
|
@ -58,5 +58,5 @@ Pulumi uses OAuth client from 1Password (blumeops vault):
|
|||
|
||||
## Related
|
||||
|
||||
- [[routing | Routing]] - Service URLs
|
||||
- [[hosts | Hosts]] - Device inventory
|
||||
- [[routing|Routing]] - Service URLs
|
||||
- [[hosts|Hosts]] - Device inventory
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Registry of all applications deployed via [[argocd]].
|
|||
| `grafana` | monitoring | Helm chart (forge mirror) | [[grafana]] |
|
||||
| `grafana-config` | monitoring | `argocd/manifests/grafana-config/` | [[grafana]] |
|
||||
| `immich` | immich | Helm chart | [[immich]] |
|
||||
| `alloy-k8s` | alloy | `argocd/manifests/alloy-k8s/` | [[alloy | Alloy]] |
|
||||
| `alloy-k8s` | alloy | `argocd/manifests/alloy-k8s/` | [[alloy|Alloy]] |
|
||||
| `kube-state-metrics` | monitoring | `argocd/manifests/kube-state-metrics/` | K8s metrics |
|
||||
| `miniflux` | miniflux | `argocd/manifests/miniflux/` | [[miniflux]] |
|
||||
| `kiwix` | kiwix | `argocd/manifests/kiwix/` | [[kiwix]] |
|
||||
|
|
@ -45,4 +45,4 @@ Registry of all applications deployed via [[argocd]].
|
|||
## Related
|
||||
|
||||
- [[argocd]] - GitOps platform details
|
||||
- [[cluster | Cluster]] - Kubernetes infrastructure
|
||||
- [[cluster|Cluster]] - Kubernetes infrastructure
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Single-node Minikube cluster running on [[indri]].
|
|||
|
||||
## Volume Mounting
|
||||
|
||||
Pods mount NFS directly from [[sifaka | Sifaka]]. Docker NATs outbound traffic through indri's LAN IP (192.168.1.50), allowing access to Sifaka's NFS exports.
|
||||
Pods mount NFS directly from [[sifaka|Sifaka]]. Docker NATs outbound traffic through indri's LAN IP (192.168.1.50), allowing access to Sifaka's NFS exports.
|
||||
|
||||
## Registry Mirror
|
||||
|
||||
|
|
@ -34,6 +34,6 @@ Mirrors configured: `registry.ops.eblu.me`, `docker.io`, `ghcr.io`, `quay.io`
|
|||
|
||||
## Related
|
||||
|
||||
- [[apps | Apps]] - ArgoCD applications
|
||||
- [[apps|Apps]] - ArgoCD applications
|
||||
- [[argocd]] - GitOps deployment
|
||||
- [[zot]] - Registry mirror
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Services exposed via Tailscale Ingress are **not accessible** from:
|
|||
- Other Kubernetes pods (they're not Tailscale clients)
|
||||
- Docker containers on indri
|
||||
|
||||
For pod-to-service communication, use [[routing | Caddy]] (`*.ops.eblu.me`) instead.
|
||||
For pod-to-service communication, use [[routing|Caddy]] (`*.ops.eblu.me`) instead.
|
||||
|
||||
## Related
|
||||
|
||||
|
|
|
|||
|
|
@ -11,5 +11,5 @@ Daily automated backups of BlumeOps data.
|
|||
## Components
|
||||
|
||||
- [[borgmatic]] - Backup orchestration
|
||||
- [[sifaka | Sifaka]] - Backup target (NAS)
|
||||
- [[backups | backup-policy]] - What gets backed up and retention
|
||||
- [[sifaka|Sifaka]] - Backup target (NAS)
|
||||
- [[backups|backup-policy]] - What gets backed up and retention
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ tags:
|
|||
|
||||
TBD. Current state:
|
||||
|
||||
- [[borgmatic]] provides daily backups to [[sifaka | Sifaka]]
|
||||
- [[borgmatic]] provides daily backups to [[sifaka|Sifaka]]
|
||||
- Infrastructure can be rebootstrapped using the blumeops repo
|
||||
- Detailed DR procedures not yet documented
|
||||
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ Metrics, logs, and dashboards for BlumeOps infrastructure.
|
|||
|
||||
- [[prometheus]] - Metrics storage and querying
|
||||
- [[loki]] - Log aggregation
|
||||
- [[alloy | Alloy]] - Metrics and log collection
|
||||
- [[alloy|Alloy]] - Metrics and log collection
|
||||
- [[grafana]] - Dashboards and visualization
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Individual service reference cards with URLs and configuration details.
|
|||
|
||||
| Service | Description | Location |
|
||||
|---------|-------------|----------|
|
||||
| [[alloy | Alloy]] | Observability collector (metrics & logs) | indri + k8s |
|
||||
| [[alloy|Alloy]] | Observability collector (metrics & logs) | indri + k8s |
|
||||
| [[argocd]] | GitOps continuous delivery | k8s |
|
||||
| [[borgmatic]] | Backup system | indri |
|
||||
| [[caddy]] | Reverse proxy & TLS termination | indri |
|
||||
|
|
@ -40,18 +40,18 @@ Individual service reference cards with URLs and configuration details.
|
|||
|
||||
Host inventory and network configuration.
|
||||
|
||||
- [[hosts | Hosts]] - Device inventory
|
||||
- [[hosts|Hosts]] - Device inventory
|
||||
- [[indri]] - Primary server
|
||||
- [[gilbert]] - Development workstation
|
||||
- [[tailscale]] - ACLs, groups, tags
|
||||
- [[routing | Routing]] - DNS domains, port mappings
|
||||
- [[routing|Routing]] - DNS domains, port mappings
|
||||
|
||||
## Kubernetes
|
||||
|
||||
Cluster configuration and application registry.
|
||||
|
||||
- [[cluster | Cluster]] - Minikube specs, storage, networking
|
||||
- [[apps | Apps]] - ArgoCD application registry
|
||||
- [[cluster|Cluster]] - Minikube specs, storage, networking
|
||||
- [[apps|Apps]] - ArgoCD application registry
|
||||
- [[tailscale-operator]] - Tailscale ingress for k8s services
|
||||
- [[external-secrets]] - Secrets management
|
||||
|
||||
|
|
@ -65,9 +65,9 @@ Configuration management for [[indri]]-hosted services.
|
|||
|
||||
Network storage and backup configuration.
|
||||
|
||||
- [[sifaka | Sifaka]] - Synology NAS configuration
|
||||
- [[sifaka|Sifaka]] - Synology NAS configuration
|
||||
- [[postgresql-storage]] - Database cluster
|
||||
- [[backups | Backups]] - Backup policy and schedule
|
||||
- [[backups|Backups]] - Backup policy and schedule
|
||||
|
||||
## Operations
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ tags:
|
|||
|
||||
# ArgoCD
|
||||
|
||||
GitOps continuous delivery platform for the [[cluster | Kubernetes cluster]].
|
||||
GitOps continuous delivery platform for the [[cluster|Kubernetes cluster]].
|
||||
|
||||
## Quick Reference
|
||||
|
||||
|
|
@ -33,5 +33,5 @@ GitOps continuous delivery platform for the [[cluster | Kubernetes cluster]].
|
|||
|
||||
## Related
|
||||
|
||||
- [[apps | Apps]] - Full application registry
|
||||
- [[apps|Apps]] - Full application registry
|
||||
- [[forgejo]] - Git source
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Daily backup system using Borg backup, running on indri.
|
|||
| **Install** | mise (pipx) |
|
||||
| **Config** | `~/.config/borgmatic/config.yaml` |
|
||||
| **Schedule** | Daily at 2:00 AM |
|
||||
| **Repository** | `/Volumes/backups/borg/` on [[sifaka | Sifaka]] |
|
||||
| **Repository** | `/Volumes/backups/borg/` on [[sifaka|Sifaka]] |
|
||||
|
||||
## What Gets Backed Up
|
||||
|
||||
|
|
@ -54,6 +54,6 @@ Dashboard: "Borgmatic Backups" in [[grafana]]
|
|||
|
||||
## Related
|
||||
|
||||
- [[backups | Backups]] - Full backup policy
|
||||
- [[sifaka | Sifaka]] - Backup target
|
||||
- [[backups|Backups]] - Full backup policy
|
||||
- [[sifaka|Sifaka]] - Backup target
|
||||
- [[postgresql]] - Database backups
|
||||
|
|
|
|||
|
|
@ -47,4 +47,4 @@ Optional annotation: `grafana_folder: "FolderName"`
|
|||
|
||||
- [[prometheus]] - Metrics datasource
|
||||
- [[loki]] - Logs datasource
|
||||
- [[alloy | Alloy]] - Data collector
|
||||
- [[alloy|Alloy]] - Data collector
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ Self-hosted photo and video management.
|
|||
| **Namespace** | `immich` |
|
||||
| **Deployment** | Helm chart (k8s) |
|
||||
| **Database** | [[postgresql]] (CNPG) |
|
||||
| **Storage** | [[sifaka | Sifaka]] photos volume |
|
||||
| **Storage** | [[sifaka|Sifaka]] photos volume |
|
||||
|
||||
## Related
|
||||
|
||||
- [[postgresql]] - Database backend
|
||||
- [[sifaka | Sifaka]] - Photo storage
|
||||
- [[sifaka|Sifaka]] - Photo storage
|
||||
- [[jellyfin]] - Video streaming (separate service)
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ Dashboard > Playback:
|
|||
## Observability
|
||||
|
||||
- Metrics: `jellyfin_metrics` ansible role
|
||||
- Logs: Forwarded via [[alloy | Alloy]]
|
||||
- Logs: Forwarded via [[alloy|Alloy]]
|
||||
- Dashboard: "Jellyfin Media Server" in [[grafana]]
|
||||
|
||||
## Related
|
||||
|
||||
- [[navidrome]] - Music streaming
|
||||
- [[sifaka | Sifaka]] - Media storage
|
||||
- [[sifaka|Sifaka]] - Media storage
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Offline Wikipedia and ZIM archive server.
|
|||
| **Tailscale URL** | https://kiwix.tail8d86e.ts.net |
|
||||
| **Namespace** | `kiwix` |
|
||||
| **Image** | `ghcr.io/kiwix/kiwix-serve:3.8.1` |
|
||||
| **Storage** | NFS from [[sifaka | Sifaka]] (`/volume1/torrents`) |
|
||||
| **Storage** | NFS from [[sifaka|Sifaka]] (`/volume1/torrents`) |
|
||||
|
||||
## Architecture
|
||||
|
||||
|
|
@ -49,4 +49,4 @@ Full list: `argocd/manifests/kiwix/configmap-zim-torrents.yaml`
|
|||
## Related
|
||||
|
||||
- [[transmission]] - Downloads ZIM files
|
||||
- [[sifaka | Sifaka]] - ZIM storage
|
||||
- [[sifaka|Sifaka]] - ZIM storage
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Log aggregation system for BlumeOps infrastructure.
|
|||
|
||||
- Single-node deployment with filesystem storage
|
||||
- TSDB index with 24h period
|
||||
- Logs collected by [[alloy | Alloy]] and pushed via Loki API
|
||||
- Logs collected by [[alloy|Alloy]] and pushed via Loki API
|
||||
- Queried via [[grafana]]
|
||||
|
||||
## Log Sources
|
||||
|
|
@ -46,6 +46,6 @@ Log aggregation system for BlumeOps infrastructure.
|
|||
|
||||
## Related
|
||||
|
||||
- [[alloy | Alloy]] - Log collector
|
||||
- [[alloy|Alloy]] - Log collector
|
||||
- [[grafana]] - Log visualization
|
||||
- [[prometheus]] - Metrics counterpart
|
||||
|
|
|
|||
|
|
@ -39,4 +39,4 @@ The `/data` directory contains SQLite database, configuration, and cache.
|
|||
## Related
|
||||
|
||||
- [[jellyfin]] - Video streaming
|
||||
- [[sifaka | Sifaka]] - Music storage
|
||||
- [[sifaka|Sifaka]] - Music storage
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Database cluster via CloudNativePG operator.
|
|||
| miniflux | app owner | Owns miniflux database |
|
||||
| teslamate | superuser | TeslaMate (needs extensions) |
|
||||
| eblume | superuser | Admin access |
|
||||
| borgmatic | pg_read_all_data | [[borgmatic | Backup]] access |
|
||||
| borgmatic | pg_read_all_data | [[borgmatic|Backup]] access |
|
||||
|
||||
## Backup
|
||||
|
||||
|
|
|
|||
|
|
@ -23,19 +23,19 @@ Metrics storage and querying for BlumeOps infrastructure.
|
|||
## Data Sources
|
||||
|
||||
### Remote Write (from Alloy)
|
||||
- Indri system metrics via [[alloy | Alloy]] remote_write
|
||||
- Indri system metrics via [[alloy|Alloy]] remote_write
|
||||
- Textfile metrics: minikube, borgmatic, zot, jellyfin
|
||||
|
||||
### Scrape Targets
|
||||
|
||||
| Target | Metrics |
|
||||
|--------|---------|
|
||||
| `sifaka:9100` | [[sifaka | Sifaka]] NAS (node_exporter) |
|
||||
| `cnpg-metrics.tail8d86e.ts.net:9187` | [[postgresql | CloudNativePG]] metrics |
|
||||
| `sifaka:9100` | [[sifaka|Sifaka]] NAS (node_exporter) |
|
||||
| `cnpg-metrics.tail8d86e.ts.net:9187` | [[postgresql|CloudNativePG]] metrics |
|
||||
| `kube-state-metrics.monitoring.svc:8080` | Kubernetes resource metrics |
|
||||
|
||||
## Related
|
||||
|
||||
- [[alloy | Alloy]] - Metrics collector
|
||||
- [[alloy|Alloy]] - Metrics collector
|
||||
- [[grafana]] - Visualization
|
||||
- [[loki]] - Logs counterpart
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ BitTorrent daemon, primarily for downloading ZIM archives for [[kiwix]].
|
|||
| **Tailscale URL** | https://torrent.tail8d86e.ts.net |
|
||||
| **Namespace** | `torrent` |
|
||||
| **Image** | `lscr.io/linuxserver/transmission:latest` |
|
||||
| **Storage** | NFS PVC from [[sifaka | Sifaka]] |
|
||||
| **Storage** | NFS PVC from [[sifaka|Sifaka]] |
|
||||
|
||||
## Storage Layout
|
||||
|
||||
|
|
@ -43,11 +43,11 @@ When downloads complete, the zim-watcher CronJob detects new ZIMs and restarts K
|
|||
|
||||
## Monitoring
|
||||
|
||||
Basic uptime via blackbox probe in [[alloy | Alloy]] k8s (Services Health dashboard).
|
||||
Basic uptime via blackbox probe in [[alloy|Alloy]] k8s (Services Health dashboard).
|
||||
|
||||
Web UI shows: active/seeding/paused counts, speeds, disk usage.
|
||||
|
||||
## Related
|
||||
|
||||
- [[kiwix]] - ZIM archive consumer
|
||||
- [[sifaka | Sifaka]] - Download storage
|
||||
- [[sifaka|Sifaka]] - Download storage
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ OCI-native container registry providing pull-through cache and private image sto
|
|||
|
||||
## Pull-Through Cache
|
||||
|
||||
When [[cluster | minikube]] pulls an image, containerd checks zot first. If cached, returns immediately. If not, zot fetches from upstream, caches it, then returns.
|
||||
When [[cluster|minikube]] pulls an image, containerd checks zot first. If cached, returns immediately. If not, zot fetches from upstream, caches it, then returns.
|
||||
|
||||
## Security Model
|
||||
|
||||
|
|
@ -39,4 +39,4 @@ Network access only (no authentication). Defense is the Tailscale ACL boundary.
|
|||
## Related
|
||||
|
||||
- [[forgejo]] - Container build CI
|
||||
- [[cluster | Cluster]] - Registry consumer
|
||||
- [[cluster|Cluster]] - Registry consumer
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ tags:
|
|||
|
||||
# Backup Policy
|
||||
|
||||
Daily automated backups from [[indri]] to [[sifaka | Sifaka]] NAS.
|
||||
Daily automated backups from [[indri]] to [[sifaka|Sifaka]] NAS.
|
||||
|
||||
## Schedule
|
||||
|
||||
|
|
@ -30,8 +30,8 @@ Daily automated backups from [[indri]] to [[sifaka | Sifaka]] NAS.
|
|||
|
||||
| Database | Host | Method |
|
||||
|----------|------|--------|
|
||||
| miniflux | [[postgresql | pg.ops.eblu.me]] | pg_dump stream |
|
||||
| teslamate | [[postgresql | pg.ops.eblu.me]] | pg_dump stream |
|
||||
| miniflux | [[postgresql|pg.ops.eblu.me]] | pg_dump stream |
|
||||
| teslamate | [[postgresql|pg.ops.eblu.me]] | pg_dump stream |
|
||||
|
||||
## Sifaka-Native Data
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ Some data lives directly on [[sifaka]] rather than being backed up to it (photos
|
|||
|
||||
## Backup Target
|
||||
|
||||
Repository: `/Volumes/backups/borg/` on [[sifaka | Sifaka]]
|
||||
Repository: `/Volumes/backups/borg/` on [[sifaka|Sifaka]]
|
||||
|
||||
## Monitoring
|
||||
|
||||
|
|
@ -70,5 +70,5 @@ Dashboard: "Borgmatic Backups" in [[grafana]]
|
|||
## Related
|
||||
|
||||
- [[borgmatic]] - Backup system details
|
||||
- [[sifaka | Sifaka]] - Backup storage
|
||||
- [[sifaka|Sifaka]] - Backup storage
|
||||
- [[postgresql]] - Database backups
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ Node exporter running in Docker container, scraped by [[prometheus]] at `sifaka:
|
|||
|
||||
## Backup
|
||||
|
||||
Sifaka is the **target** for [[backup | backups]], not a backup source. [[borgmatic]] sends backups TO sifaka, not OF sifaka.
|
||||
Sifaka is the **target** for [[backup|backups]], not a backup source. [[borgmatic]] sends backups TO sifaka, not OF sifaka.
|
||||
|
||||
Data protection for sifaka itself currently relies on the Synology RAID 5 configuration, which provides single-disk fault tolerance. Future plans include offsite duplication for additional resiliency.
|
||||
|
||||
## Related
|
||||
|
||||
- [[backups | Backups]] - Backup policy
|
||||
- [[backups|Backups]] - Backup policy
|
||||
- [[borgmatic]] - Backup system
|
||||
- [[immich]] - Photo consumer
|
||||
- [[jellyfin]] - Media consumer
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ This tutorial walks through deploying a new service to BlumeOps via ArgoCD, incl
|
|||
|
||||
## Prerequisites
|
||||
|
||||
- Access to the [[tailscale | Tailscale]] network
|
||||
- Access to the [[tailscale|Tailscale]] network
|
||||
- `kubectl` configured with `minikube-indri` context
|
||||
- `argocd` CLI installed (via Brewfile: `brew bundle`)
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,9 @@ Types (file suffix): `.feature`, `.bugfix`, `.infra`, `.doc`, `.ai`, `.misc`
|
|||
### Wiki-Link Formatting
|
||||
|
||||
Use simple wiki-links without alternate text or extra spaces:
|
||||
- Prefer `[[borgmatic]]` over `[[borgmatic | Borgmatic]]`
|
||||
- Prefer `[[borgmatic]]` over `[[borgmatic|Borgmatic]]`
|
||||
- Only use alternate text when grammatically warranted (e.g., `[[cluster|Kubernetes]]` reads better than `[[cluster]]`)
|
||||
- No spaces around the pipe: `[[path|Text]]` not `[[ path | Text ]]`
|
||||
- No spaces around the pipe: `[[path|Text]]` not `[[ path|Text ]]`
|
||||
|
||||
When editing documentation, rewrite links to follow this convention as you encounter them.
|
||||
|
||||
|
|
|
|||
|
|
@ -30,16 +30,20 @@ from rich.table import Table
|
|||
|
||||
DOCS_DIR = Path(__file__).parent.parent / "docs"
|
||||
|
||||
# Regex to match wiki-links: [[Target]] or [[Target | Display]]
|
||||
WIKILINK_PATTERN = re.compile(r"\[\[([^\]|]+)(?:\s*\|\s*[^\]]+)?\]\]")
|
||||
# Regex to match wiki-links: [[Target]] or [[Target|Display]]
|
||||
# Captures: group(1) = target (may have spaces), group(2) = full "|Display" part if present
|
||||
WIKILINK_PATTERN = re.compile(r"\[\[([^\]|]+)(\|[^\]]+)?\]\]")
|
||||
|
||||
# Regex to match inline code (backticks)
|
||||
INLINE_CODE_PATTERN = re.compile(r"`[^`]+`")
|
||||
|
||||
|
||||
def extract_wikilinks(file_path: Path) -> list[tuple[str, int]]:
|
||||
def extract_wikilinks(file_path: Path) -> list[tuple[str, int, bool]]:
|
||||
"""Extract all wiki-link targets from a markdown file with line numbers.
|
||||
|
||||
Returns list of (target, line_num, has_spaces) tuples.
|
||||
has_spaces is True if the target or pipe separator had surrounding spaces.
|
||||
|
||||
Ignores wiki-links inside inline code (backticks) as these are examples.
|
||||
"""
|
||||
content = file_path.read_text()
|
||||
|
|
@ -49,8 +53,14 @@ def extract_wikilinks(file_path: Path) -> list[tuple[str, int]]:
|
|||
# Remove inline code before searching for wiki-links
|
||||
line_without_code = INLINE_CODE_PATTERN.sub("", line)
|
||||
for match in WIKILINK_PATTERN.finditer(line_without_code):
|
||||
target = match.group(1).strip()
|
||||
links.append((target, line_num))
|
||||
raw_target = match.group(1)
|
||||
target = raw_target.strip()
|
||||
pipe_part = match.group(2) # "|Display" or None
|
||||
# Check for spaces: in target, or around the pipe
|
||||
has_spaces = raw_target != target
|
||||
if pipe_part and (raw_target.endswith(" ") or pipe_part.startswith("| ")):
|
||||
has_spaces = True
|
||||
links.append((target, line_num, has_spaces))
|
||||
|
||||
return links
|
||||
|
||||
|
|
@ -92,10 +102,11 @@ def main() -> int:
|
|||
if (REPO_ROOT / filename).exists():
|
||||
valid_targets.add(Path(filename).stem)
|
||||
|
||||
# Collect all broken, ambiguous, and path-based links
|
||||
# Collect all broken, ambiguous, path-based, and spaced links
|
||||
broken_links: list[tuple[str, int, str]] = []
|
||||
ambiguous_links: list[tuple[str, int, str, list[str]]] = []
|
||||
path_links: list[tuple[str, int, str]] = []
|
||||
spaced_links: list[tuple[str, int, str]] = []
|
||||
|
||||
# Scan all markdown files for wiki-links (excluding changelog.d/)
|
||||
for md_file in sorted(DOCS_DIR.rglob("*.md")):
|
||||
|
|
@ -105,8 +116,11 @@ def main() -> int:
|
|||
rel_path = str(md_file.relative_to(DOCS_DIR))
|
||||
links = extract_wikilinks(md_file)
|
||||
|
||||
for target, line_num in links:
|
||||
if "/" in target:
|
||||
for target, line_num, has_spaces in links:
|
||||
if has_spaces:
|
||||
# Links with spaces in target or around pipe are not allowed
|
||||
spaced_links.append((rel_path, line_num, target))
|
||||
elif "/" in target:
|
||||
# Path-based links are not allowed - use simple filenames only
|
||||
path_links.append((rel_path, line_num, target))
|
||||
elif target in ambiguous_filenames:
|
||||
|
|
@ -123,6 +137,23 @@ def main() -> int:
|
|||
|
||||
has_errors = False
|
||||
|
||||
if spaced_links:
|
||||
has_errors = True
|
||||
console.print("[bold red]Wiki-Links With Spaces Found[/bold red]")
|
||||
console.print("Wiki-links must not have spaces in the target or around the pipe.")
|
||||
console.print("Use [[target|Display Text]] not [[target | Display Text]].")
|
||||
console.print()
|
||||
table = Table(show_header=True, header_style="bold")
|
||||
table.add_column("File")
|
||||
table.add_column("Line", justify="right")
|
||||
table.add_column("Target")
|
||||
|
||||
for file_path, line_num, target in spaced_links:
|
||||
table.add_row(file_path, str(line_num), escape(f"[[{target}]]"))
|
||||
|
||||
console.print(table)
|
||||
console.print()
|
||||
|
||||
if path_links:
|
||||
has_errors = True
|
||||
console.print("[bold red]Path-Based Wiki-Links Found[/bold red]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue