wop commited on
Commit
4341f38
Β·
verified Β·
1 Parent(s): 44a7073

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +14 -1
templates/index.html CHANGED
@@ -247,6 +247,18 @@
247
  .bubble a,.best-answer-bubble a,.other-answer-text a,.version-text a {
248
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
249
  }
 
 
 
 
 
 
 
 
 
 
 
 
250
  p.md-gap { min-height: 0.6em; margin: 0 !important; padding: 0; }
251
  /* ── Vote ── */
252
  .vote-row { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
@@ -928,7 +940,8 @@
928
  out = out.replace(/\*([^*\s][^*]*[^*\s]|\S)\*/g, "<em>$1</em>");
929
  out = out.replace(/_([^_\s][^_]*[^_\s]|\S)_/g, "<em>$1</em>");
930
  out = out.replace(/~~([^~]+)~~/g, "<s>$1</s>");
931
- out = out.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, '<a href="$2" target="_blank" rel="noreferrer">$1</a>');
 
932
  return out;
933
  }
934
  function renderMarkdown(md) {
 
247
  .bubble a,.best-answer-bubble a,.other-answer-text a,.version-text a {
248
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
249
  }
250
+ .md-img {
251
+ display: block;
252
+ max-width: 100%;
253
+ min-width: 60px;
254
+ max-height: 480px;
255
+ width: auto;
256
+ height: auto;
257
+ border-radius: var(--radius-md);
258
+ border: 1px solid var(--border);
259
+ margin: 6px 0;
260
+ object-fit: contain;
261
+ }
262
  p.md-gap { min-height: 0.6em; margin: 0 !important; padding: 0; }
263
  /* ── Vote ── */
264
  .vote-row { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
 
940
  out = out.replace(/\*([^*\s][^*]*[^*\s]|\S)\*/g, "<em>$1</em>");
941
  out = out.replace(/_([^_\s][^_]*[^_\s]|\S)_/g, "<em>$1</em>");
942
  out = out.replace(/~~([^~]+)~~/g, "<s>$1</s>");
943
+ out = out.replace(/!\[([^\]]*)\]\((https?:\/\/[^\s)]+)\)/g, '<img class="md-img" src="$2" alt="$1" loading="lazy">');
944
+ out = out.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, '<a href="$2" target="_blank" rel="noreferrer">$1</a>');
945
  return out;
946
  }
947
  function renderMarkdown(md) {