mirror of
https://codeberg.org/forgejo/forgejo
synced 2025-09-16 23:22:55 +02:00
### What? - fixes HTML nodes placement for inline previews - (breaking?) disallows file previews in headings (`<h1>`, …), striked out (`<del>`), `<summary>` and other environments - allows them in `<span>`, `<em>` and `<strong>` environments, but without extra formatting - allows them in `<div>`, `<li>`, `<th>`, `<td>` and `<details>` (not in `<summary>`) environments following the parent’s formatting - improves overall HTML validity, but only to the extend of the direct parent nodes (but not a big issue, as modern browsers tend to ignore invalid HTML and still parse it) - fix #9136 See examples of strangely formatted file previews at https://v13.next.forgejo.org/mahlzahn/test/issues/4. ### How is it implemented? For links in `<p>`, `<span>`, `<em>` and `<strong>` parent nodes it inserts the file preview and following text as siblings to the **parent** node. `<em>before LINK after</em>` → `<em>before </em>PREVIEW<em> after</em>` For links in `<div>`, `<li>`, `<th>`, `<td>` and `<details>` parent nodes it inserts the file preview and following text as siblings to the **text** node. `<div>before LINK after</div>` → `<div>before PREVIEW after</div>` Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9181 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Robert Wolff <mahlzahn@posteo.de> Co-committed-by: Robert Wolff <mahlzahn@posteo.de> |
||
---|---|---|
.. | ||
asciicast | ||
common | ||
console | ||
csv | ||
external | ||
markdown | ||
mdstripper | ||
orgmode | ||
tests/repo/repo1_filepreview | ||
camo.go | ||
camo_test.go | ||
file_preview.go | ||
html.go | ||
html_internal_test.go | ||
html_test.go | ||
renderer.go | ||
renderer_test.go | ||
sanitizer.go | ||
sanitizer_test.go |