summaryrefslogtreecommitdiffstats
path: root/modules/markup
Commit message (Collapse)AuthorAgeFilesLines
* modules/markup/markdown: fix dropped test error (#16438)Lars Lehtonen2021-07-181-0/+1
|
* cleanup code `issueFullPattern` in modules/markup (#16419)Josef Fröhle2021-07-152-7/+9
| | | fix #16415
* Fix external renderer (#16401)65432021-07-121-0/+4
| | | | | | | | | * fix external renderer * use GBackground context as fallback * no fallback, return error Co-authored-by: Lauris BH <lauris@nix.lv>
* Update bluemonday to v1.0.15 (#16379)65432021-07-091-3/+3
| | | | | | | * update github.com/microcosm-cc/bluemonday * add exec flag to contrib/update_dependencies.sh * Fix TESTS
* Fix various documentation, user-facing, and source comment typos (#16367)luzpaz2021-07-083-4/+4
| | | | | * Fix various doc, user-facing, and source comment typos Found via `codespell -q 3 -S ./options/locale,./vendor -L ba,pullrequest,pullrequests,readby`
* Fix relative links in postprocessed images (#16334)zeripath2021-07-042-1/+37
| | | | | | | | | | If a pre-post-processed file contains relative img tags these need to be updated and joined correctly with the prefix. Finally, the node attributes need to be updated. Fix #16308 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Prevent zombie processes (#16314)zeripath2021-06-301-1/+9
| | | | | | | | | Unfortunately go doesn't always ensure that execd processes are completely waited for. On linux this means that zombie processes can occur. This PR ensures that these are waited for by using signal notifier in serv and passing a context elsewhere. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add custom emoji support (#16004)65432021-06-292-16/+20
|
* Add sanitizer rules per renderer (#16110)KN4CK3R2021-06-237-66/+114
| | | | | | | * Added sanitizer rules per renderer. * Updated documentation. Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add code block highlight to orgmode back (#14222)Lunny Xiao2021-06-231-0/+44
| | | | | Fix missed orgmode code block hightlight Co-authored-by: zeripath <art27@cantab.net>
* Use html.Parse rather than html.ParseFragment (#16223)zeripath2021-06-221-13/+12
| | | | | | | | * Use html.Parse rather than html.ParseFragment There have been a few issues with html.ParseFragment - just use html.Parse instead. * Skip document node Signed-off-by: Andrew Thornton <art27@cantab.net>
* More efficiently parse shas for shaPostProcessor (#16101)zeripath2021-06-212-10/+64
| | | | | | | | | | | | | | | | * More efficiently parse shas for shaPostProcessor The shaPostProcessor currently repeatedly calls git rev-parse --verify on both backends which is fine if there is only one thing that matches a sha - however if there are multiple things then this becomes wildly inefficient. This PR provides functions for both backends which are much faster to use. Fix #16092 * Add ShaExistCache to RenderContext Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Run processors on whole of text (#16155)zeripath2021-06-172-318/+411
| | | | | | | | | | | There is an inefficiency in the design of our processors which means that Emoji and other processors run in order n^2 time. This PR forces the processors to process the entirety of text node before passing back up. The fundamental inefficiency remains but it should be significantly ameliorated. Signed-off-by: Andrew Thornton <art27@cantab.net>
* issue-keyword class is being incorrectly stripped off spans (#16163)zeripath2021-06-161-5/+2
| | | | | | Bluemonday sanitizer regexp rules are not additive, so the addition of the icons, emojis and chroma syntax policy has led to this being stripped. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix data URI scramble (#16098)KN4CK3R2021-06-074-19/+23
| | | | | | | * Removed unused method. * No prefix for data uris. * Added test to prevent regressions.
* Fixed assert statements. (#16089)KN4CK3R2021-06-071-2/+2
|
* Fix regression of renderer (#16091)Lunny Xiao2021-06-061-24/+34
| | | | | * Fix regression of renderer * Fix render setting load twice bug
* Make tasklist checkboxes clickable (#15791)KN4CK3R2021-05-233-13/+14
| | | | Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv>
* Fixed individual markdown tests. (#15802)KN4CK3R2021-05-091-0/+6
|
* Fix URL of gitea emoji (#15770)silverwind2021-05-072-2/+2
| | | Fixes regression from #15219
* Refactor renders (#15175)Lunny Xiao2021-04-1913-485/+652
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor renders * Some performance optimization * Fix comment * Transform reader * Fix csv test * Fix test * Fix tests * Improve optimaziation * Fix test * Fix test * Detect file encoding with reader * Improve optimaziation * reduce memory usage * improve code * fix build * Fix test * Fix for go1.15 * Fix render * Fix comment * Fix lint * Fix test * Don't use NormalEOF when unnecessary * revert change on util.go * Apply suggestions from code review Co-authored-by: zeripath <art27@cantab.net> * rename function * Take NormalEOF back Co-authored-by: zeripath <art27@cantab.net>
* Add NeedPostProcess for Parser interface to improve performance of csv ↵Lunny Xiao2021-04-135-4/+22
| | | | render (#15153)
* Links in markdown should be absolute to the repository not the server (#15088)zeripath2021-04-112-1/+15
| | | | | | | | | | | | | | | | | * Links in markdown should be absolute to the repository not the server Fix #15075 Signed-off-by: Andrew Thornton <art27@cantab.net> * match github Signed-off-by: Andrew Thornton <art27@cantab.net> * add testcase Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de>
* Upgrade to bluemonday 1.0.7 (#15379)zeripath2021-04-091-1/+1
| | | | | | | | | | | * Upgrade to bluemonday 1.0.7 Fix #15349 Signed-off-by: Andrew Thornton <art27@cantab.net> * resolve unit test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Code Formats, Nits & Unused Func/Var deletions (#15286)65432021-04-091-3/+1
| | | | | | | | | | | | | | | * _ to unused func options * rm useless brakets * rm trifial non used models functions * rm dead code * rm dead global vars * fix routers/api/v1/repo/issue.go * dont overload import module
* Update to bluemonday-1.0.6 (#15294)zeripath2021-04-052-1/+15
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add Tabular Diff for CSV files (#14661)KN4CK3R2021-03-293-71/+48
| | | | | | | | | | | | | | | | | | | | | | | Implements request #14320 The rendering of CSV files does match the diff style. * Moved CSV logic into base package. * Added method to create a tabular diff. * Added CSV compare context. * Added CSV diff template. * Use new table style in CSV markup. * Added file size limit for CSV rendering. * Display CSV parser errors in diff. * Lazy read single file. * Lazy read rows for full diff. * Added unit tests for various CSV changes.
* Clusterfuzz found another way (#15160)zeripath2021-03-261-1/+1
| | | | | Clusterfuzz found another way so I found another way to stop it Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix another clusterfuzz identified issue (#15096)zeripath2021-03-221-1/+1
| | | | | * Fix another clusterfuzz identified issue Signed-off-by: Andrew Thornton <art27@cantab.net>
* another clusterfuzz spotted issue (#15032)zeripath2021-03-181-1/+1
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove extraneous logging (#15020)zeripath2021-03-181-5/+0
| | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix several render issues (#14986)zeripath2021-03-164-34/+130
| | | | | | | | | * Fix an issue with panics related to attributes * Wrap goldmark render in a recovery function * Reduce memory use in render emoji * Use a pipe for rendering goldmark - still needs more work and a limiter Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
* Make sure sibling images get a link too (#14979)zeripath2021-03-142-1/+43
| | | | | | | | | | | | * Make sure sibling images get a link too Due a problem with the ast.Walker in the our transformer in goldmark an image with a sibling image will not be transformed to gain a parent link. This PR fixes this. Fix #12925 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Clarify the suffices and prefixes of setting.AppSubURL and setting.AppURL ↵zeripath2021-02-191-5/+4
| | | | | | | | (#12999) Also removes some unnecessary uses of fmt.Sprintf and adds documentation strings Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove NULs byte arrays passed to PostProcess (#14587)zeripath2021-02-181-1/+23
| | | | | | | | | | | | PostProcess is supposed to be parsing and handling HTML fragments, but on fuzzing it appears that there is a weird issue with NUL elements that could cause a memory address error in downstream libraries. The simplest solution is to strip out the weird NULs - they should not be there in any case and would be stripped out anyway. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Prevent panic on fuzzer provided string (#14405)zeripath2021-01-202-10/+53
| | | | | | | | | | | | | | | | | | | * Prevent panic on fuzzer provided string The fuzzer has found that providing a <body> tag with an attribute to PostProcess causes a panic. This PR removes any rendered html or body tags from the output. Signed-off-by: Andrew Thornton <art27@cantab.net> * Placate lint * placate lint again Signed-off-by: Andrew Thornton <art27@cantab.net> * minor cleanup Signed-off-by: Andrew Thornton <art27@cantab.net>
* Render links for commit hashes followed by comma (#14224)Nuno Silva2021-01-032-1/+7
| | | | | Regex test cases: https://regex101.com/r/mVbPxM/2/ fixes #14223
* Fix bug of link query order on markdown render (#14156)Lunny Xiao2020-12-291-1/+1
| | | | | | | * Fix bug of link query order on markdown render * Fix bluemonday bug and fix one wrong test Co-authored-by: 6543 <6543@obermui.de>
* Add mentionable teams to tributeValues and change team mention rules to gh's ↵a10121127962020-12-211-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | style (#13198) * Add mentionable teams to tributeValues Signed-off-by: a1012112796 <1012112796@qq.com> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Change team mention rules to gh's style * use org's avator as team avator in ui Signed-off-by: a1012112796 <1012112796@qq.com> * Update modules/markup/html.go * Update models/issue.go Co-authored-by: Lauris BH <lauris@nix.lv> * Update models/issue.go * fix a small nit and update test code Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Markdown task list improvements (#13952)silverwind2020-12-134-10/+10
| | | | | | | | | | | | * Markdown task list improvements - Remove `.ui` class and wrappers to prevent fomantic from messing with it. - Change rendered HTML to match GitHub. - Add custom styling for the checkboxes. * fix unittest Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix crash in short link processor (#13839)mrsdizzie2020-12-041-10/+12
| | | Fixes #13819
* Clickable links in pull request (and issue) titles (#13695)Jimmy Praet2020-12-031-0/+19
| | | | | | | | | * clickable links in pull request (and issue) titles #13658 reuses the existing logic to render clickable links in commit messages * dedicated RenderIssueTitle function applied patch from @mrsdizzie
* Update golangci-lint to version 1.31.0 (#13102)kolaente2020-10-112-5/+5
| | | | | | | This PR updates golangci-lint to the latest version 1.31.0. The upgrade introduced a new check for which I've fixed or disabled most cases. Signed-off-by: kolaente <k@knt.li>
* fix: media links in org files not liked to media files (#12997)Pranav Nachnekar2020-10-011-3/+17
| | | | | | | | | | | * fix: media links in org files not liked to media files * fix: write directly to io.Writer r as suggested by code review Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: zeripath <art27@cantab.net>
* Fix markdown meta parsing (#12817)John Olheiser2020-09-122-7/+72
| | | | | | | | | | | | | | | | | | | | | | | * Fix meta parsing and add minimal test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add license Signed-off-by: jolheiser <john.olheiser@gmail.com> * Require first separator and add more tests Signed-off-by: jolheiser <john.olheiser@gmail.com> * Make fmt Signed-off-by: jolheiser <john.olheiser@gmail.com> * Go lets this work gracefully :pray: Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Don't replace underscores in auto-generated IDs in goldmark (#12805)zeripath2020-09-121-1/+1
| | | | | Fix #12196 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Issue templates directory (#11450)John Olheiser2020-09-111-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Issue templates Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add some comments, appease the linter Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add docs and re-use dir candidates Signed-off-by: jolheiser <john.olheiser@gmail.com> * Add default labels to issue templates Signed-off-by: jolheiser <john.olheiser@gmail.com> * Generate swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> * Suggested changes Signed-off-by: jolheiser <john.olheiser@gmail.com> * Update issue.go * Suggestions Signed-off-by: jolheiser <john.olheiser@gmail.com> * Extract metadata from legacy if possible Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Update to go-org 1.3.2 (#12728)zeripath2020-09-051-3/+3
| | | | | | | | | | | | | * Update to go-org 1.3.2 Fix #12727 Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix unit test Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix emoji replacements, make emoji images consistent (#12567)silverwind2020-08-232-1/+2
| | | | | | | - Fix emoji not being replaced in issue title change text - Make the image attributes consistent, add alt, remove align Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Re-attempt to delete temporary upload if the file is locked by another ↵zeripath2020-08-111-1/+7
| | | | | | | | | | | process (#12447) Replace all calls to os.Remove/os.RemoveAll by retrying util.Remove/util.RemoveAll and remove circular dependencies from util. Fix #12339 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>