docs: вложения статей (doc_files), подписи и библиотека картинок, быстрое ред. отзыва
This commit is contained in:
+5
-2
@@ -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(/&/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(/&/g, '&'));
|
||||
|
||||
Reference in New Issue
Block a user