1
0
mirror of https://gitcode.com/gitea/gitea.git synced 2025-06-20 11:54:15 +08:00
Commit Graph

11 Commits

Author SHA1 Message Date
6cee3bfa96 Refactor markup render to fix various path problems ()
* Fix 
    * Use consistent path resolving for links and medias.
* No need to make the markup renders to resolve the paths, instead, the
paths are all correctly resolved in the "post process" step.
* Fix 
* Since 1.23, all paths starting with "/" are relative to current render
context (for example: the current repo branch)
* Introduce `/:root/path-relative-to-root`, then the path will be
rendered as relative to "ROOT_URL"
2025-04-04 23:45:23 +08:00
9bfa9f450d Refactor "string truncate" () 2024-12-26 11:56:03 +08:00
594edad213 Do not render truncated links in markdown ()
Fixes 
2024-12-26 00:33:55 +08:00
633785a5f3 Refactor markup render system ()
This PR removes (almost) all path tricks, and introduces "renderhelper"
package.

Now we can clearly see the rendering behaviors for comment/file/wiki,
more details are in "renderhelper" tests.

Fix  , fix , fix  and maybe more problems. (ps: fix
 by the way)
2024-11-24 16:18:57 +08:00
c4e27cb27b Refactor markup render system ()
This PR mainly moves some code and introduces `RenderContext.WithXxx`
functions
2024-11-22 05:48:09 +00:00
8a20fba8eb Refactor markup render system ()
Remove unmaintainable sanitizer rules. No need to add special "class"
regexp rules anymore, use RenderInternal.SafeAttr instead, more details
(and examples) are in the tests
2024-11-18 13:25:42 +08:00
5eebe1dc5f Fix and refactor markdown rendering () 2024-11-16 08:41:44 +00:00
3f9c3e7bc3 Refactor render system ()
There were too many patches to the Render system, it's really difficult
to make further improvements.

This PR clears the legacy problems and fix TODOs.

1. Rename `RenderContext.Type` to `RenderContext.MarkupType` to clarify
its usage.
2. Use `ContentMode` to replace `meta["mode"]` and `IsWiki`, to clarify
the rendering behaviors.
3. Use "wiki" mode instead of "mode=gfm + wiki=true"
4. Merge `renderByType` and `renderByFile`
5. Add more comments

----

The problem of "mode=document": in many cases it is not set, so many
non-comment places use comment's hard line break incorrectly
2024-11-14 05:02:11 +00:00
61be51e56b Refactor markup package ()
To make the markup package easier to maintain:
1. Split some go files into small files
2. Use a shared util.NopCloser, remove duplicate code
3. Remove unused functions
2024-11-04 10:59:50 +00:00
2010fbe060 Fix raw wiki links ()
Fix 

This regression is introduced by . To find out how GitHub handles
this case, I did [some
tests](https://github.com/go-gitea/gitea/issues/31395#issuecomment-2278929115).

I use redirect in this PR instead of checking if the corresponding `.md`
file exists when rendering the link because GitHub also uses redirect.
With this PR, there is no need to resolve the raw wiki link when
rendering a wiki page. If a wiki link points to a raw file, access will
be redirected to the raw link.
2024-08-16 20:40:51 +08:00
21783a5752 Fix rendered wiki page link ()
Fix 
2024-06-18 03:09:20 +00:00