aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup
Commit message (Collapse)AuthorAgeFilesLines
* Fix markdown frontmatter rendering (#34102) (#34107)wxiaoguang2025-04-037-117/+128
| | | | Backport #34102 Fix #34101
* Fix markdown render (#33870) (#33875)Giteabot2025-03-144-21/+22
| | | | | Backport #33870 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update go tool dependencies (#32916) (#33355)silverwind2025-01-224-4/+4
| | | | Clean cherry-pick of https://github.com/go-gitea/gitea/pull/32916. Update all go tool dependencies to latest version.
* Fix "stop time tracking button" on navbar (#33084) (#33300)wxiaoguang2025-01-171-1/+1
| | | | Backport #33084 (no conflict) Fix #33299, and remove incorrect translations
* Fix `git remote` error check, fix dependencies, fix js error (#33129) (#33133)wxiaoguang2025-01-081-2/+2
| | | | | | | | | | | | | And update some dependencies to fix bugs. Backport #33129, #33136 Fix #32889 Fix #33141 Fix #33139 --------- Co-authored-by: yp05327 <576951401@qq.com>
* Do not render truncated links in markdown (#32980) (#32983)Giteabot2024-12-262-0/+15
| | | | | Backport #32980 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Backport 1.23 (#32868)wxiaoguang2024-12-171-1/+2
| | | Co-authored-by: delvh <dev.lh@web.de>
* Enable tenv and testifylint rules (#32852)TheFox0x72024-12-151-2/+2
| | | | Enables tenv and testifylint linters closes: https://github.com/go-gitea/gitea/issues/32842
* Refactor markdown math render (#32831)wxiaoguang2024-12-148-140/+125
| | | Add more tests
* Fix various UI bugs (#32821)wxiaoguang2024-12-133-26/+36
|
* Refactor markdown render (#32736)wxiaoguang2024-12-065-31/+100
| | | and add some tests
* Refactor markdown render (#32728)wxiaoguang2024-12-066-166/+268
| | | | Follow up recent render system refactoring PRs (split test code), and fine tune the math render (added some new cases)
* Fix issue title rendering and refactor legacy function names (#32703)wxiaoguang2024-12-043-22/+31
| | | | | | | | Fix #32700, regression of recent markup refactoring And by the way, clarify many legacy problems: 1. Some "RenderXxx" functions do not really "render", they only call "post processors" 2. Merge "RenderEmoji | RenderCodeBlock", they are all for "simple issue title"
* Refactor render system (orgmode) (#32671)wxiaoguang2024-11-292-50/+46
| | | Close #29100
* Refactor markup render system (#32645)wxiaoguang2024-11-266-215/+178
| | | | | | | This PR mainly removes some global variables, moves some code and renames some functions to make code clearer. This PR also removes a testing-only option ForceHardLineBreak during refactoring since the behavior is clear now.
* Refactor markup render system (#32612)wxiaoguang2024-11-2428-929/+312
| | | | | | | | | | 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 #31411 , fix #18592, fix #25632 and maybe more problems. (ps: fix #32608 by the way)
* Refactor markup render system (#32589)wxiaoguang2024-11-2221-347/+299
| | | | This PR mainly moves some code and introduces `RenderContext.WithXxx` functions
* Refactor markup render system (#32533)wxiaoguang2024-11-1831-439/+472
| | | | | 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
* Fix and refactor markdown rendering (#32522)wxiaoguang2024-11-1616-188/+190
|
* Refactor render system (#32492)wxiaoguang2024-11-1415-155/+138
| | | | | | | | | | | | | | | | | | | 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
* Support quote selected comments to reply (#32431)wxiaoguang2024-11-076-16/+32
| | | | | | | | | Many existing tests were quite hacky, these could be improved later. <details> ![image](https://github.com/user-attachments/assets/93aebb4f-9de5-4cb8-910b-50c64cbcd25a) </details>
* Refactor markup package (#32399)wxiaoguang2024-11-0414-1062/+1137
| | | | | | 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
* Update go dependencies (#32389)wxiaoguang2024-10-314-4/+4
|
* refactor: remove redundant err declarations (#32381)Oleksandr Redko2024-10-301-2/+1
|
* Use camo.Always instead of camo.Allways (#32097)Lunny Xiao2024-09-212-2/+2
| | | | | Fix #31575 https://gitea.com/gitea/docs/pulls/73
* Fix raw wiki links (#31825)Zettat1232024-08-163-22/+16
| | | | | | | | | | | | | | Fix #31395 This regression is introduced by #30273. 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.
* Fix `IsObjectExist` with gogit (#31790)Jason Song2024-08-091-1/+2
| | | | | | | | | | | | | Fix #31271. When gogit is enabled, `IsObjectExist` calls `repo.gogitRepo.ResolveRevision`, which is not correct. It's for checking references not objects, it could work with commit hash since it's both a valid reference and a commit object, but it doesn't work with blob objects. So it causes #31271 because it reports that all blob objects do not exist.
* Fix markdown preview $$ support (#31514)charles2024-06-296-6/+79
| | | | | | | | | | | | | | | | | | | | | | close #31481 currently `$$A + B$$ test` will ignore text after $$ block test text ![圖片](https://github.com/go-gitea/gitea/assets/30816317/39b2974b-c0b6-48a0-87d0-5f4a13615eed) before fix ![圖片](https://github.com/go-gitea/gitea/assets/30816317/15469e4c-474d-4128-b46f-d6cadaafbd68) after fix ![圖片](https://github.com/go-gitea/gitea/assets/30816317/c1025eef-177f-4ade-988f-510e7039f3f9) github display ![圖片](https://github.com/go-gitea/gitea/assets/30816317/97cd1e10-ac94-4899-86d8-8e359ef1d694)
* bump golang deps (#31422)techknowlogick2024-06-241-1/+1
|
* Support relative paths to videos from Wiki pages (#31061)Sergey Sharybin2024-06-213-43/+83
| | | | | | | | | | | | | | | | | | This change fixes cases when a Wiki page refers to a video stored in the Wiki repository using relative path. It follows the similar case which has been already implemented for images. Test plan: - Create repository and Wiki page - Clone the Wiki repository - Add video to it, say `video.mp4` - Modify the markdown file to refer to the video using `<video src="video.mp4">` - Commit the Wiki page - Observe that the video is properly displayed --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix markdown math brackets render problem (#31420)charles2024-06-202-1/+9
| | | | | Close #31371, support `($ ... $)` like GitHub Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix rendered wiki page link (#31398)wxiaoguang2024-06-186-66/+51
| | | Fix #31395
* Refactor markup code (#31399)wxiaoguang2024-06-172-37/+10
| | | | | | 1. use clearer names 2. remove deadcode 3. avoid name shadowing 4. eliminate some lint warnings
* Fix missing images in editor preview due to wrong links (#31299)Brecht Van Lommel2024-06-171-4/+4
| | | | | | | | | | Parse base path and tree path so that media links can be correctly created with /media/. Resolves #31294 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor to use UnsafeStringToBytes (#31358)Oleksandr Redko2024-06-142-6/+6
| | | | | | | The PR replaces all `goldmark/util.BytesToReadOnlyString` with `util.UnsafeBytesToString`, `goldmark/util.StringToReadOnlyBytes` with `util.UnsafeStringToBytes`. This removes one `TODO`. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix hash render end with colon (#31319)Lunny Xiao2024-06-122-1/+2
| | | | Fix a hash render problem like `<hash>: xxxxx` which is usually used in release notes.
* Add `MAX_ROWS` option for CSV rendering (#30268)Henrique Pimentel2024-06-062-69/+35
| | | | | | | | | | | | | | | | | | | This solution implements a new config variable MAX_ROWS, which corresponds to the “Maximum allowed rows to render CSV files. (0 for no limit)” and rewrites the Render function for CSV files in markup module. Now the render function only reads the file once, having MAX_FILE_SIZE+1 as a reader limit and MAX_ROWS as a row limit. When the file is larger than MAX_FILE_SIZE or has more rows than MAX_ROWS, it only renders until the limit, and displays a user-friendly warning informing that the rendered data is not complete, in the user's language. --- Previously, when a CSV file was larger than the limit, the render function lost its function to render the code. There were also multiple reads to the file, in order to determine its size and render or pre-render. The warning: ![image](https://s3.amazonaws.com/i.snag.gy/vcKh90.jpg)
* Make blockquote attention recognize more syntaxes (#31240)wxiaoguang2024-06-043-19/+86
| | | Fix #31214
* Make pasted "img" tag has the same behavior as markdown image (#31235)wxiaoguang2024-06-044-58/+74
| | | | | | | Fix #31230 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Split sanitizer functions and fine-tune some tests (#31192)wxiaoguang2024-05-318-245/+270
|
* Use repo as of renderctx's member rather than a repoPath on metas (#29222)Lunny Xiao2024-05-306-39/+99
| | | | Use a `gitrepo.Repository` in the markup's RenderContext but not store the repository's path.
* Refactor AppURL usage (#30885)wxiaoguang2024-05-071-1/+1
| | | | | | | | Fix #30883 Fix #29591 --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix markdown URL parsing for commit ID (#30812)wxiaoguang2024-05-044-74/+115
|
* Fix markdown rendering when mentioning users (#30795)wxiaoguang2024-05-021-8/+7
|
* Resolve lint for unused parameter and unnecessary type arguments (#30750)Chongyi Zheng2024-04-297-13/+10
| | | | | | | | | | Resolve all cases for `unused parameter` and `unnecessary type arguments` Related: #30729 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* Enable more `revive` linter rules (#30608)silverwind2024-04-221-2/+0
| | | | | | | | | | | Noteable additions: - `redefines-builtin-id` forbid variable names that shadow go builtins - `empty-lines` remove unnecessary empty lines that `gofumpt` does not remove for some reason - `superfluous-else` eliminate more superfluous `else` branches Rules are also sorted alphabetically and I cleaned up various parts of `.golangci.yml`.
* Use raw Wiki links for non-renderable Wiki files (#30273)Rafael2024-04-104-16/+55
| | | | | | | | | | | | | | | | | | | In Wiki pages, short-links created to local Wiki files were always expanded as regular Wiki Links. In particular, if a link wanted to point to a file that Gitea doesn't know how to render (e.g, a .zip file), a user following the link would be silently redirected to the Wiki's home page. This change makes short-links* in Wiki pages be expanded to raw wiki links, so these local wiki files may be accessed without manually accessing their URL. * only short-links ending in a file extension that isn't renderable are affected. Closes #27121. Signed-off-by: Rafael Girão <rafael.s.girao@tecnico.ulisboa.pt> Co-authored-by: silverwind <me@silverwind.io>
* Fix code block style for code preview (#30298)wxiaoguang2024-04-061-1/+1
| | | | | Fix #30292 To avoid unnecessary style overriding, use "div" instead of "code"
* Fixes #27605: inline math blocks can't be preceeded/followed by ↵João Tiago2024-04-022-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alphanumerical characters (#30175) - Inline math blocks couldn't be preceeded or succeeded by alphanumerical characters due to changes introduced in PR #21171. Removed the condition that caused this (precedingCharacter condition) and added a new exit condition of the for-loop that checks if a specific '$' was escaped using '\' so that the math expression can be rendered as intended. - Additionally this PR fixes another bug where math blocks of the type '$xyz$abc$' where the dollar sign was not escaped by the user, generated an error (shown in the screenshots below) - Altered the tests to accomodate for the changes Former behaviour (from try.gitea.io): ![image](https://github.com/go-gitea/gitea/assets/114936010/8f0cbb21-321d-451c-b871-c67a8e1e9235) Fixed behaviour (from my local build): ![image](https://github.com/go-gitea/gitea/assets/114936010/5c22687c-6f11-4407-b5e7-c14b838bc20d) (Edit) Source code for the README.md file: ``` $x$ -$x$ $x$- a$xa$ $xa$a 1$xb$ $xb$1 $a a$b b$ a$b $a a$b b$ $a a\$b b$ ``` --------- Signed-off-by: João Tiago <joao.leal.tintas@tecnico.ulisboa.pt> Co-authored-by: Giteabot <teabot@gitea.io>
* Render embedded code preview by permlink in markdown (#30234)wxiaoguang2024-04-025-0/+145
| | | | | The permlink in markdown will be rendered as a code preview block, like GitHub Co-authored-by: silverwind <me@silverwind.io>