✨ feat(vitepress): enhance title extraction from files
📝 docs(ffmpeg): add title to ffmpeg README
This commit is contained in:
+19
-2
@@ -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) {
|
||||
|
||||
@@ -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`:
|
||||
|
||||
Reference in New Issue
Block a user