feat(vitepress): enhance title extraction from files

📝 docs(ffmpeg): add title to ffmpeg README
This commit is contained in:
Sergey Krashevich
2026-01-19 02:40:02 +03:00
parent 1d9bb27f58
commit ba9fb70929
2 changed files with 21 additions and 2 deletions
+19 -2
View File
@@ -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) {
+2
View File
@@ -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`: