aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup
Commit message (Collapse)AuthorAgeFilesLines
* Enable gocritic `equalFold` and fix issues (#34952)silverwind7 days1-2/+1
| | | | | | | Continuation of https://github.com/go-gitea/gitea/pull/34678. --------- Signed-off-by: silverwind <me@silverwind.io>
* Add support for 3D/CAD file formats preview (#34794)Kerwin Bryant13 days3-23/+59
| | | | | | | Fix #34775 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* enforce explanation for necessary nolints and fix bugs (#34883)TheFox0x72025-06-274-4/+4
| | | | | | | Follows up https://github.com/go-gitea/gitea/pull/34851 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* enforce nolint scope (#34851)TheFox0x72025-06-271-2/+2
| | | | | | | | | | | | | | | enable nolintlint scope requirement add comments to new directives so it's more obvious why they are in place --- I can also toggle the mandatory comments on if that's something of interest. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor template helper (#34819)wxiaoguang2025-06-242-3/+3
| | | | | | | | FIx abuses and remove unused code --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
* Refactor wiki (#34805)wxiaoguang2025-06-222-4/+5
| | | Remove unclear code
* Improve img lazy loading (#34804)wxiaoguang2025-06-213-9/+22
| | | Related #32051 and #13526
* Run `gopls modernize` on codebase (#34751)silverwind2025-06-188-21/+13
| | | | Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
* Fix commit message rendering and some UI problems (#34680)wxiaoguang2025-06-102-3/+7
| | | | | | * Fix #34679 * Fix #34676 * Fix #34674 * Fix #34526
* Fix footnote jump behavior on the issue page. (#34621)charles2025-06-095-3/+43
| | | | | | | | | | Close #34511 Close #34590 Add comment ID to the footnote item's id attribute to ensure uniqueness. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Valid email address should only start with alphanumeric (#28174)Dejan Kitic2025-04-203-10/+43
| | | | | | | | | | | | This fixes issue #27847 where regular expression allowed email address to start with special symbols. Valid email addresses should start with alphanumeric character, and as such will be rendered as email. Added test cases from the bug report to validate, such input will not be rendered anymore as email address. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* markup: improve code block readability and isolate copy button (#34009)D2025-04-191-7/+2
| | | | | | | | Fix #33197 Improve the rendering of code blocks in markdown content for better readability and UI stability across screen sizes. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Uniform all temporary directories and allow customizing temp path (#32352)Lunny Xiao2025-04-081-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR uniform all temporary directory usage so that it will be easier to manage. Relate to #31792 - [x] Added a new setting to allow users to configure the global temporary directory. - [x] Move all temporary files and directories to be placed under os.Temp()/gitea. - [x] `setting.Repository.Local.LocalCopyPath` now will be `setting.TempPath/local-repo` and the customized path is removed. ```diff -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;[repository.local] -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; Path for local repository copy. Defaults to TEMP_PATH + `local-repo`, this is deprecated and cannot be changed -;LOCAL_COPY_PATH = local-repo ``` - [x] `setting.Repository.Upload.TempPath` now will be `settting.TempPath/uploads` and the customized path is removed. ```diff ;[repository.upload] -;; -;; Path for uploads. Defaults to TEMP_PATH + `uploads` -;TEMP_PATH = uploads ``` - [x] `setting.Packages.ChunkedUploadPath` now will be `settting.TempPath/package-upload` and the customized path is removed. ```diff ;[packages] -;; -;; Path for chunked uploads. Defaults it's `package-upload` under `TEMP_PATH` unless it's an absolute path. -;CHUNKED_UPLOAD_PATH = package-upload ``` - [x] `setting.SSH.KeyTestPath` now will be `settting.TempPath/ssh_key_test` and the customized path is removed. ```diff [server] -;; -;; Directory to create temporary files in when testing public keys using ssh-keygen, -;; default is the system temporary directory. -;SSH_KEY_TEST_PATH = ``` TODO: - [ ] setting.PprofDataPath haven't been changed because it may need to be kept until somebody read it but temp path may be clean up any time. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make markdown render match GitHub's behavior (#34129)wxiaoguang2025-04-062-4/+11
| | | For #2246
* Fix markdown render behaviors (#34122)wxiaoguang2025-04-056-46/+109
| | | | | | | * Fix #27645 * Add config options `MATH_CODE_BLOCK_DETECTION`, problematic syntaxes are disabled by default * Fix #33639 * Add config options `RENDER_OPTIONS_*`, old behaviors are kept
* Refactor markup render to fix various path problems (#34114)wxiaoguang2025-04-0419-245/+194
| | | | | | | | | | | * Fix #33972 * 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 #33274 * 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"
* Fix markdown frontmatter rendering (#34102)wxiaoguang2025-04-037-106/+124
| | | Fix #34101
* Enable addtional linters (#34085)TheFox0x72025-04-013-7/+6
| | | | | | | | enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Enable testifylint rules (#34075)TheFox0x72025-03-316-15/+15
| | | | enable testifylint rules disabled in: https://github.com/go-gitea/gitea/pull/34054
* enable staticcheck QFxxxx rules (#34064)TheFox0x72025-03-294-12/+17
|
* Fix markdown render (#33870)wxiaoguang2025-03-134-21/+22
| | | | | Fix #33869, some code block is moved to make it easier to test. Added a new test
* Refactor global init code and add more comments (#33755)wxiaoguang2025-03-031-0/+4
| | | | | | | | | | | | | | | | | | | Follow up #33748 Now there are 3 "global" functions: * registerGlobalSelectorFunc: for all elements matching the selector, eg: `.ui.dropdown` * registerGlobalInitFunc: for `data-global-init="initInputAutoFocusEnd"` * registerGlobalEventFunc: for `data-global-click="onCommentReactionButtonClick"` And introduce `initGlobalInput` to replace old `initAutoFocusEnd` and `attachDirAuto`, use `data-global-init` to replace fragile `.js-autofocus-end` selector. Another benefit is that by the new approach, no matter how many times `registerGlobalInitFunc` is called, we only need to do one "querySelectorAll" in the last step, it could slightly improve the performance.
* Use test context in tests and new loop system in benchmarks (#33648)TheFox0x72025-02-205-9/+6
| | | | | | | | Replace all contexts in tests with go1.24 t.Context() --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* chore: fix some trivial problems and TODOs (#33473)wxiaoguang2025-02-021-1/+1
| | | | | | | | | | | 1. Fix incorrect `MentionCount` (actually it seems to be deadcode, affects nothing) 2. Remove fallback sha1 support for time limit token 3. Use route middleware `reqRepoActionsWriter` for `ArtifactsDeleteView` 4. Use clearer message "Failed to authenticate user" instead of "Verify" when auth fails 5. `tests/integration/benchmarks_test.go` is not quite right, actually it is never used, so delete it. 6. Remove or update TODO comments
* Refactor context repository (#33202)wxiaoguang2025-01-122-3/+3
|
* Refactor older tests to use testify (#33140)TheFox0x72025-01-091-16/+8
| | | | | Refactor checks to use assert/require Use require.Eventually for waiting in elastic and meilisearch tests Use require to exit early instead of assert
* Refactor HTMLFormat, update chroma render, fix js error (#33136)wxiaoguang2025-01-084-5/+7
| | | | | | A small refactor to improve HTMLFormat, to help to prevent low-level mistakes. And fix #33141, fix #33139
* Fix "stop time tracking button" on navbar (#33084)wxiaoguang2025-01-031-1/+1
| | | | | | | | Fix #33083 By the way (something I was working on): 1. relax color/background-color for more markup elements 2. fix a command line sentence error
* Refactor "string truncate" (#32984)wxiaoguang2024-12-262-4/+4
|
* Do not render truncated links in markdown (#32980)wxiaoguang2024-12-262-0/+15
| | | Fixes #31780
* Add sub issue list support (#32940)wxiaoguang2024-12-244-39/+143
| | | Just like GitHub, show issue icon/title when the issue number is in a list
* Update go tool dependencies (#32916)silverwind2024-12-194-4/+4
| | | | | | | | | | | | | | | | | Update all go tool dependencies to latest version. WIP because I think there are new gopls errors, would like to confirm them on CI first. Here is from a local run: ``` modules/markup/markdown/goldmark.go:115:37-53: unnecessary type arguments modules/markup/html.go:45:32-49: unnecessary type arguments modules/markup/internal/renderinternal.go:20:33-49: unnecessary type arguments modules/markup/common/linkify.go:27:32-49: unnecessary type arguments modules/util/time_str.go:28:39-63: unnecessary type arguments routers/web/repo/pull.go:704:19: impossible condition: non-nil == nil modules/util/util_test.go:248:14-23: unused parameter: other ``` ~~Backport because the `gxz` update might have security benefits.~~
* Fix various trivial problems (#32861)wxiaoguang2024-12-171-1/+2
| | | | | | | | | | | | | | 1. add/improve comments to help future readers could understand the problem more easily. 2. add an error log to LDAP with username fallback 3. use `or` instead of `Iif` for "repo/branch_dropdown" (`Iif` was a mistake, but it doesn't really affect the UI) 4. add `tw-font-mono` style to container digest to match dockerhub 5. fix a bug in RepoBranchTagSelector: the form is not updated when there is no click to an item --------- 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
|