Thumbnails: prefer *_thumb child note, fallback to first image; round embedded images and inline code; theme figcaptions
This commit is contained in:
+6
-2
@@ -101,7 +101,11 @@ function run() {
|
||||
return SHARE_BASE + "/" + encodeURIComponent("tag-" + slugifyTag(t));
|
||||
}
|
||||
|
||||
function firstImageSrc(a) {
|
||||
function thumbSrc(a) {
|
||||
try {
|
||||
const thumbs = (a.getChildNotes() || []).filter(n => /_thumb\.[A-Za-z0-9]+$/i.test(n.title));
|
||||
if (thumbs.length) return "api/notes/" + thumbs[0].noteId + "/download";
|
||||
} catch (e) {}
|
||||
try {
|
||||
const m = String(a.getContent() || "").match(/<img[^>]+src="([^"]+)"/);
|
||||
return m ? m[1] : "";
|
||||
@@ -118,7 +122,7 @@ function run() {
|
||||
const summary = a.getLabelValue("summary") || "";
|
||||
const link = `${SHARE_BASE}/${encodeURIComponent(a.getLabelValue("shareAlias") || a.noteId)}`;
|
||||
const tags = tagList(a);
|
||||
const thumb = firstImageSrc(a);
|
||||
const thumb = thumbSrc(a);
|
||||
|
||||
lines.push('<article class="blog-post">');
|
||||
lines.push(' <header class="blog-post-header">');
|
||||
|
||||
Reference in New Issue
Block a user