gitea/modules/markup
Giteabot e194d89c74
Improve and fix markup code preview rendering (#35777) (#35787)
Backport #35777 by @silverwind

1. Add the color on the link to the referenced file, which is the more
likely thing the user wants to click
2. Use monospace font on the SHA
3. Tweak text colors
4. Change SHA link to go to the commit instead of the repo root with
commit filter set
5. Added the repo name to the file link text
6. Fix broken line numbering rendering

The only major difference to GitHub is now the missing line numbers.

Before:

<img width="286" height="162" alt="Screenshot 2025-10-29 at 19 09 59"
src="https://github.com/user-attachments/assets/f16b4eec-caf2-4c31-a2b5-ae5f41747d4b"
/>

After:

<img width="378" height="157" alt="image"
src="https://github.com/user-attachments/assets/0c91dfd3-0910-4b2d-a43b-8c87cfbb933e"
/>

For comparison, GitHub rendering:

<img width="286" height="177" alt="image"
src="https://github.com/user-attachments/assets/8a9a07b7-9153-4415-9d7a-5685853e472a"
/>

Co-authored-by: silverwind <me@silverwind.io>
2025-10-30 09:06:44 +00:00
..
asciicast Refactor context repository (#33202) 2025-01-12 03:39:46 +00:00
common enforce nolint scope (#34851) 2025-06-27 07:59:55 +02:00
console Add support for 3D/CAD file formats preview (#34794) 2025-06-30 16:12:25 +08:00
csv Enable testifylint rules (#34075) 2025-03-31 01:53:48 -04:00
external Fix external render, make iframe render work (#35727, #35730) (#35731) 2025-10-23 16:07:17 +08:00
internal Fix external render, make iframe render work (#35727, #35730) (#35731) 2025-10-23 16:07:17 +08:00
markdown enforce explanation for necessary nolints and fix bugs (#34883) 2025-06-27 21:48:03 +08:00
mdstripper Enable gocritic `equalFold` and fix issues (#34952) 2025-07-06 16:53:34 +00:00
orgmode Update chroma to v2.20.0 (#35220) 2025-08-11 13:00:20 +02:00
camo.go Use camo.Always instead of camo.Allways (#32097) 2024-09-21 12:50:54 +03:00
camo_test.go Use camo.Always instead of camo.Allways (#32097) 2024-09-21 12:50:54 +03:00
html.go Run `gopls modernize` on codebase (#34751) 2025-06-18 01:48:09 +00:00
html_codepreview.go Refactor markup render system (#32612) 2024-11-24 16:18:57 +08:00
html_codepreview_test.go Refactor markup render system (#32612) 2024-11-24 16:18:57 +08:00
html_commit.go Run `gopls modernize` on codebase (#34751) 2025-06-18 01:48:09 +00:00
html_email.go Valid email address should only start with alphanumeric (#28174) 2025-04-20 19:18:14 +08:00
html_emoji.go Avoid emoji mismatch and allow to only enable chosen emojis (#35692) (#35705) 2025-10-20 08:29:02 +08:00
html_internal_test.go Refactor markup render to fix various path problems (#34114) 2025-04-04 23:45:23 +08:00
html_issue.go Refactor markup render to fix various path problems (#34114) 2025-04-04 23:45:23 +08:00
html_issue_test.go Fix footnote jump behavior on the issue page. (#34621) 2025-06-09 17:18:11 +00:00
html_link.go Run `gopls modernize` on codebase (#34751) 2025-06-18 01:48:09 +00:00
html_mention.go Refactor markup render to fix various path problems (#34114) 2025-04-04 23:45:23 +08:00
html_node.go Improve img lazy loading (#34804) 2025-06-21 14:53:22 +08:00
html_test.go Avoid emoji mismatch and allow to only enable chosen emojis (#35692) (#35705) 2025-10-20 08:29:02 +08:00
main_test.go Refactor markup render system (#32612) 2024-11-24 16:18:57 +08:00
render.go Fix external render, make iframe render work (#35727, #35730) (#35731) 2025-10-23 16:07:17 +08:00
render_helper.go Refactor markup render to fix various path problems (#34114) 2025-04-04 23:45:23 +08:00
render_link.go Fix various typos in codebase (#35480) 2025-09-13 10:34:43 -04:00
render_link_test.go Use test context in tests and new loop system in benchmarks (#33648) 2025-02-20 09:57:40 +00:00
renderer.go Fix external render, make iframe render work (#35727, #35730) (#35731) 2025-10-23 16:07:17 +08:00
sanitizer.go Split sanitizer functions and fine-tune some tests (#31192) 2024-05-31 13:26:01 +00:00
sanitizer_custom.go Refactor markup render system (#32533) 2024-11-18 13:25:42 +08:00
sanitizer_default.go Improve and fix markup code preview rendering (#35777) (#35787) 2025-10-30 09:06:44 +00:00
sanitizer_default_test.go Refactor wiki (#34805) 2025-06-22 18:53:33 +08:00
sanitizer_description.go Split sanitizer functions and fine-tune some tests (#31192) 2024-05-31 13:26:01 +00:00
sanitizer_description_test.go Split sanitizer functions and fine-tune some tests (#31192) 2024-05-31 13:26:01 +00:00