更新Docker
This commit is contained in:
@@ -33,13 +33,21 @@ export function stripNumberPrefix(title) {
|
||||
* 输出压缩为单行、去除行内 Markdown,按中文句末标点截断(≤100 字符)。
|
||||
*/
|
||||
export function extractDescription(md) {
|
||||
let body = String(md).replace(/^---[\s\S]*?\n---\s*/, "");
|
||||
const src = String(md);
|
||||
const fm = src.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
||||
const body = fm ? src.slice(fm[0].length) : src;
|
||||
|
||||
let text = "";
|
||||
const tip = body.match(/^:::\s*tip[^\n]*\n([\s\S]*?)\n:::/m);
|
||||
// frontmatter description 显式声明优先(无 H1 页面的补齐手段)
|
||||
const fmDesc = fm && fm[1].match(/^description:\s*(.+)$/m);
|
||||
if (fmDesc) {
|
||||
text = fmDesc[1].trim().replace(/^["']|["']$/g, "");
|
||||
}
|
||||
const tip = !text && body.match(/^:::\s*tip[^\n]*\n([\s\S]*?)\n:::/m);
|
||||
if (tip) {
|
||||
text = tip[1];
|
||||
} else {
|
||||
}
|
||||
if (!text) {
|
||||
const afterH1 = body.match(/^# (?!#)(.+)$/m);
|
||||
if (afterH1) {
|
||||
const rest = body.slice((afterH1.index ?? 0) + afterH1[0].length);
|
||||
|
||||
Reference in New Issue
Block a user