diff --git a/web/docs/index.php b/web/docs/index.php index d92f10f..42178b2 100644 --- a/web/docs/index.php +++ b/web/docs/index.php @@ -63,15 +63,15 @@ function render_tree(string $dir, string $rel): string { } $body = ''; +$title = $page; $f = $mdDir . '/' . $page . '.md'; if (is_file($f)) { $raw = (string)file_get_contents($f); $raw = str_replace("\r", "", $raw); + /* title = first '# ' line of the raw markdown (not the rendered body) */ + if (preg_match('/^#\s+(.+)$/m', $raw, $m)) $title = trim($m[1]); $body = md($raw); } -// crumb title = file's first heading or slug -$title = $page; -if ($body !== '' && preg_match('/^#\s+(.+)$/m', str_replace('<', '', $body), $m)) $title = trim(strip_tags($m[1])); if (isset($_GET['ajax'])) { /* partial response for AJAX nav (no layout) */ echo '
文档 / ' . htmlspecialchars($title) . '
'; diff --git a/web/docs/md/index.md b/web/docs/md/index.md index 7bf85af..1f4f6c0 100644 --- a/web/docs/md/index.md +++ b/web/docs/md/index.md @@ -7,7 +7,7 @@ ## 一分钟装好 ```bash -curl -sSL https://pmm.parlz.com/install.sh | bash +curl -sSL https://pmm.parlz.com/download/install.sh | bash ``` 装好后: