From ba9fb70929b7c2e58ddb1626ce2b24b023224bb6 Mon Sep 17 00:00:00 2001 From: Sergey Krashevich Date: Mon, 19 Jan 2026 02:40:02 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(vitepress):=20enhance=20title?= =?UTF-8?q?=20extraction=20from=20files=20=F0=9F=93=9D=20docs(ffmpeg):=20a?= =?UTF-8?q?dd=20title=20to=20ffmpeg=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/config.mts | 21 +++++++++++++++++++-- internal/ffmpeg/README.md | 2 ++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 09c46e70..874118c6 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -24,8 +24,25 @@ function walkForReadmes(dir: string, results: string[]) { function extractTitle(filePath: string) { const content = fs.readFileSync(filePath, 'utf8'); - const match = content.match(/^#\s+(.+)$/m); - return match ? match[1].trim() : ''; + let inFence = false; + + for (const line of content.split(/\r?\n/)) { + if (/^(```|~~~)/.test(line)) { + inFence = !inFence; + continue; + } + + if (inFence) { + continue; + } + + const match = line.match(/^#\s+(.+)$/); + if (match) { + return match[1].trim(); + } + } + + return ''; } function toTitleCase(value: string) { diff --git a/internal/ffmpeg/README.md b/internal/ffmpeg/README.md index 903aab5d..46419975 100644 --- a/internal/ffmpeg/README.md +++ b/internal/ffmpeg/README.md @@ -1,3 +1,5 @@ +# ffmpeg + ## FFplay output [FFplay](https://stackoverflow.com/questions/27778678/what-are-mv-fd-aq-vq-sq-and-f-in-a-video-stream) `7.11 A-V: 0.003 fd= 1 aq= 21KB vq= 321KB sq= 0B f=0/0`: