docs: вложения статей (doc_files), подписи и библиотека картинок, быстрое ред. отзыва

This commit is contained in:
dev
2026-11-01 11:06:23 +03:00
parent a6f5953c61
commit 9a509fa742
12 changed files with 947 additions and 25 deletions
+5 -2
View File
@@ -27,10 +27,13 @@
return `\u0000${codes.length - 1}\u0000`;
});
text = esc(text);
text = text.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (m, alt, src) => {
text = text.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"([^"]*)")?\)/g, (m, alt, src, title) => {
const url = safeUrl(src.replace(/&/g, '&'));
if (!url) return alt;
return `<img src="${esc(thumbUrl(url))}" data-img="${esc(url)}" alt="${esc(alt)}" loading="lazy">`;
const t = title ? title.replace(/&amp;/g, '&') : '';
const img = `<img src="${esc(thumbUrl(url))}" data-img="${esc(url)}" alt="${esc(alt)}"${t ? ` title="${esc(t)}"` : ''} loading="lazy">`;
if (t) return `<figure class="md-figure">${img}<figcaption>${esc(t)}</figcaption></figure>`;
return img;
});
text = text.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (m, label, href) => {
const url = safeUrl(href.replace(/&amp;/g, '&'));