From f3ad4ad977296d9cba65f65a8eea0ac775b470e6 Mon Sep 17 00:00:00 2001 From: Alex X Date: Sat, 7 Feb 2026 00:08:47 +0300 Subject: [PATCH] Fix links in docs --- internal/api/README.md | 2 +- internal/ffmpeg/hardware/README.md | 2 +- internal/wyoming/README.md | 10 +++++----- website/.vitepress/config.js | 32 ++++++++++++++++++++++++++---- 4 files changed, 35 insertions(+), 11 deletions(-) diff --git a/internal/api/README.md b/internal/api/README.md index 2e17ff85..ca01fb6d 100644 --- a/internal/api/README.md +++ b/internal/api/README.md @@ -4,7 +4,7 @@ The HTTP API is the main part for interacting with the application. Default addr The HTTP API is described in [OpenAPI](../../website/api/openapi.yaml) format. It can be explored in [interactive viewer](https://go2rtc.org/api/). WebSocket API described [here](ws/README.md). -The project's static HTML and JS files are located in the [www](../../www) folder. An external developer can use them as a basis for integrating go2rtc into their project or for developing a custom web interface for go2rtc. +The project's static HTML and JS files are located in the [www](../../www/README.md) folder. An external developer can use them as a basis for integrating go2rtc into their project or for developing a custom web interface for go2rtc. The contents of `www` folder are built into go2rtc when building, but you can use configuration to specify an external folder as the source of static files. diff --git a/internal/ffmpeg/hardware/README.md b/internal/ffmpeg/hardware/README.md index 4a122ecb..6cad4c27 100644 --- a/internal/ffmpeg/hardware/README.md +++ b/internal/ffmpeg/hardware/README.md @@ -2,7 +2,7 @@ You **DON'T** need hardware acceleration if: -- you're not using the [FFmpeg source](https://github.com/AlexxIT/go2rtc#source-ffmpeg) +- you're not using the [FFmpeg source](../README.md) - you're using only `#video=copy` for the FFmpeg source - you're using only `#audio=...` (any audio) transcoding for the FFmpeg source diff --git a/internal/wyoming/README.md b/internal/wyoming/README.md index f3c00191..ed02c9ba 100644 --- a/internal/wyoming/README.md +++ b/internal/wyoming/README.md @@ -23,13 +23,13 @@ This module provide [Wyoming Protocol](https://www.home-assistant.io/integration 3. Wake Word (WAKE) - [OpenWakeWord](https://www.home-assistant.io/voice_control/create_wake_word/) 4. Speech-to-Text (STT) - - [Whisper](https://github.com/home-assistant/addons/blob/master/whisper/README.md) - - [Vosk](https://github.com/rhasspy/hassio-addons/blob/master/vosk/README.md) + - [Whisper](https://github.com/home-assistant/addons/blob/master/whisper/) + - [Vosk](https://github.com/rhasspy/hassio-addons/blob/master/vosk/) 5. Conversation agent (INTENT) - [Home Assistant](https://www.home-assistant.io/integrations/conversation/) 6. Text-to-speech (TTS) - [Google Translate](https://www.home-assistant.io/integrations/google_translate/) - - [Piper](https://github.com/home-assistant/addons/blob/master/piper/README.md) + - [Piper](https://github.com/home-assistant/addons/blob/master/piper/) 7. Audio stream (SND) - any source with two-way audio (backchannel) and PCM codec support (include PCMA/PCMU) @@ -63,7 +63,7 @@ wake_uri: tcp://192.168.1.23:10400?name=alexa_v0.1&name=hey_jarvis_v0.1&name=hey ## Events -You can add wyoming event handling using the [expr](https://github.com/AlexxIT/go2rtc/blob/master/internal/expr/README.md) language. For example, to pronounce TTS on some media player from HA. +You can add wyoming event handling using the [expr](../expr/README.md) language. For example, to pronounce TTS on some media player from HA. Turn on the logs to see what kind of events happens. @@ -94,7 +94,7 @@ Supported functions and variables: - `PlayFile(path)` - play audio from `wav` file - `Type` - type (name) of event - `Data` - event data in JSON format (ex. `{"text":"how are you"}`) -- also available other functions from [expr](https://github.com/AlexxIT/go2rtc/blob/master/internal/expr/README.md) module (ex. `fetch`) +- also available other functions from [expr](../expr/README.md) module (ex. `fetch`) If you write a script for an event - the default action is no longer executed. You need to repeat the necessary steps yourself. diff --git a/website/.vitepress/config.js b/website/.vitepress/config.js index e66ca806..a31d9b94 100644 --- a/website/.vitepress/config.js +++ b/website/.vitepress/config.js @@ -1,5 +1,22 @@ import {defineConfig} from 'vitepress'; +function replace_link(md) { + md.core.ruler.after('inline', 'replace-link', function (state) { + for (const block of state.tokens) { + if (block.type === 'inline' && block.children) { + for (const token of block.children) { + const href = token.attrGet('href'); + if (href && href.indexOf('README.md') >= 0) { + // token.attrJoin('style', 'color:red;'); + token.attrSet('href', href.replace('README.md', 'index.md')); + } + } + } + } + return true; + }); +} + export default defineConfig({ title: 'go2rtc', themeConfig: { @@ -128,15 +145,22 @@ export default defineConfig({ ], socialLinks: [ - {icon: "github", link: "https://github.com/AlexxIT/go2rtc"} + {icon: 'github', link: 'https://github.com/AlexxIT/go2rtc'} ], outline: [2, 3], search: {provider: 'local'}, }, - rewrites: { - 'README.md': 'index.md', - '(.*)/README.md': '(.*)/index.md', + rewrites(id) { + // change file names + return id.replace('README.md', 'index.md'); + }, + + markdown: { + config: (md) => { + // change markdown links + md.use(replace_link); + } }, srcDir: '..',