Commit c763bb7
Rework markup link rendering (go-gitea#26745)
Fixes go-gitea#26548
This PR refactors the rendering of markup links. The old code uses
`strings.Replace` to change some urls while the new code uses more
context to decide which link should be generated.
The added tests should ensure the same output for the old and new
behaviour (besides the bug).
We may need to refactor the rendering a bit more to make it clear how
the different helper methods render the input string. There are lots of
options (resolve links / images / mentions / git hashes / emojis / ...)
but you don't really know what helper uses which options. For example,
we currently support images in the user description which should not be
allowed I think:
<details>
<summary>Profile</summary>
https://try.gitea.io/KN4CK3R

</details>
---------
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>1 parent ce6cb0a commit c763bb7
File tree
42 files changed
+967
-395
lines changed- models
- issues
- repo
- modules
- markup
- external
- markdown
- orgmode
- templates
- routers
- common
- web
- feed
- org
- repo
- user
- services/mailer
- templates
- repo
- branch
- diff
- graph
- issue
- user/dashboard
- tests/fuzz
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
42 files changed
+967
-395
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | | - | |
114 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
588 | | - | |
| 587 | + | |
589 | 588 | | |
590 | 589 | | |
591 | 590 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
124 | | - | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
130 | | - | |
131 | | - | |
| 131 | + | |
| 132 | + | |
132 | 133 | | |
133 | 134 | | |
134 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 83 | | |
89 | 84 | | |
90 | 85 | | |
91 | | - | |
| 86 | + | |
92 | 87 | | |
93 | 88 | | |
94 | 89 | | |
| |||
344 | 339 | | |
345 | 340 | | |
346 | 341 | | |
347 | | - | |
| 342 | + | |
348 | 343 | | |
349 | 344 | | |
350 | 345 | | |
| |||
375 | 370 | | |
376 | 371 | | |
377 | 372 | | |
378 | | - | |
| 373 | + | |
379 | 374 | | |
380 | 375 | | |
381 | 376 | | |
| |||
390 | 385 | | |
391 | 386 | | |
392 | 387 | | |
393 | | - | |
| 388 | + | |
394 | 389 | | |
395 | 390 | | |
396 | 391 | | |
397 | 392 | | |
398 | 393 | | |
399 | 394 | | |
400 | | - | |
| 395 | + | |
401 | 396 | | |
402 | 397 | | |
403 | 398 | | |
404 | 399 | | |
405 | 400 | | |
406 | 401 | | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
| 402 | + | |
| 403 | + | |
415 | 404 | | |
416 | 405 | | |
417 | 406 | | |
418 | 407 | | |
419 | 408 | | |
420 | 409 | | |
421 | | - | |
| 410 | + | |
422 | 411 | | |
423 | 412 | | |
424 | 413 | | |
| |||
444 | 433 | | |
445 | 434 | | |
446 | 435 | | |
447 | | - | |
| 436 | + | |
448 | 437 | | |
449 | 438 | | |
450 | 439 | | |
| |||
641 | 630 | | |
642 | 631 | | |
643 | 632 | | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | 633 | | |
649 | 634 | | |
650 | 635 | | |
| |||
665 | 650 | | |
666 | 651 | | |
667 | 652 | | |
668 | | - | |
| 653 | + | |
669 | 654 | | |
670 | 655 | | |
671 | 656 | | |
| |||
740 | 725 | | |
741 | 726 | | |
742 | 727 | | |
743 | | - | |
| 728 | + | |
744 | 729 | | |
745 | 730 | | |
746 | 731 | | |
| |||
751 | 736 | | |
752 | 737 | | |
753 | 738 | | |
754 | | - | |
755 | 739 | | |
756 | 740 | | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
| 741 | + | |
764 | 742 | | |
765 | 743 | | |
766 | 744 | | |
| |||
789 | 767 | | |
790 | 768 | | |
791 | 769 | | |
792 | | - | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
793 | 773 | | |
794 | | - | |
795 | 774 | | |
796 | 775 | | |
797 | 776 | | |
798 | 777 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
| 778 | + | |
804 | 779 | | |
805 | 780 | | |
806 | 781 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
| 290 | + | |
| 291 | + | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | | - | |
307 | | - | |
308 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
319 | 323 | | |
320 | 324 | | |
321 | 325 | | |
| |||
342 | 346 | | |
343 | 347 | | |
344 | 348 | | |
345 | | - | |
346 | | - | |
347 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
348 | 354 | | |
349 | 355 | | |
350 | 356 | | |
| |||
0 commit comments