Commit 1cbbc634 authored by 谢宇轩's avatar 谢宇轩

fix: edit content html build

parent edea36c0
...@@ -206,8 +206,10 @@ function mdToHtmlBody(md, titleEn, assetIdByFilename) { ...@@ -206,8 +206,10 @@ function mdToHtmlBody(md, titleEn, assetIdByFilename) {
let alt = ''; let alt = '';
if (i + 1 < lines.length) { if (i + 1 < lines.length) {
const cap = lines[i + 1].trim().match(/^\*(.+)\*$/); const cap = lines[i + 1].trim().match(/^\*(.+)\*$/);
if (cap) { alt = cap[1]; i++; } if (cap) { alt = cap[1].trim(); i++; }
} }
// Placeholder alt "alt" carries no real caption — drop the annotation.
if (alt === 'alt') alt = '';
const assetId = assetIdByFilename ? assetIdByFilename.get(filename) : null; const assetId = assetIdByFilename ? assetIdByFilename.get(filename) : null;
const src = assetId != null ? `asset://${assetId}` : ''; const src = assetId != null ? `asset://${assetId}` : '';
if (alt) { if (alt) {
...@@ -217,6 +219,9 @@ function mdToHtmlBody(md, titleEn, assetIdByFilename) { ...@@ -217,6 +219,9 @@ function mdToHtmlBody(md, titleEn, assetIdByFilename) {
} }
i++; continue; i++; continue;
} }
// Skip the "(无图片)" placeholder harvest.js writes when an article has
// no images — it should not appear in the pushed HTML body.
if (trimmed === '(无图片)') { i++; continue; }
// Blockquote > text // Blockquote > text
if (trimmed.match(/^>\s*(.*)$/)) { if (trimmed.match(/^>\s*(.*)$/)) {
flush(); flush();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment