]> source.dussan.org Git - gitea.git/commitdiff
Fix issue markdown bugs (#17411)
authorwxiaoguang <wxiaoguang@gmail.com>
Sat, 23 Oct 2021 13:38:12 +0000 (21:38 +0800)
committerGitHub <noreply@github.com>
Sat, 23 Oct 2021 13:38:12 +0000 (21:38 +0800)
* Bug fix: render Markdown http://AppURL/org/repo/issues/4?a=1&b=2#comment-123 test to HTML correctly, close #17394
* Bug fix: fix the positions of checkboxes in rendered HTML, close #17395

modules/markup/html.go
modules/markup/html_internal_test.go
web_src/less/markup/content.less

index d5ae237b5b526280c024028d21a7c6154e121d4d..746830720da903d9ceeb7b70ac8fb98f78eb21cb 100644 (file)
@@ -94,7 +94,7 @@ var issueFullPatternOnce sync.Once
 func getIssueFullPattern() *regexp.Regexp {
        issueFullPatternOnce.Do(func() {
                issueFullPattern = regexp.MustCompile(regexp.QuoteMeta(setting.AppURL) +
-                       `\w+/\w+/(?:issues|pulls)/((?:\w{1,10}-)?[1-9][0-9]*)([\?|#]\S+.(\S+)?)?\b`)
+                       `\w+/\w+/(?:issues|pulls)/((?:\w{1,10}-)?[1-9][0-9]*)([\?|#](\S+)?)?\b`)
        })
        return issueFullPattern
 }
index dbad350de2c56744b4dc58282b76c1f1ea4374bb..f9ef90744b173fe09b5ac72ac3db615aea8e9253 100644 (file)
@@ -265,6 +265,10 @@ func TestRender_FullIssueURLs(t *testing.T) {
                `<a href="http://localhost:3000/person/repo/issues/4#issuecomment-1234" class="ref-issue">person/repo#4</a>`)
        test("http://localhost:3000/gogits/gogs/issues/4",
                `<a href="http://localhost:3000/gogits/gogs/issues/4" class="ref-issue">#4</a>`)
+       test("http://localhost:3000/gogits/gogs/issues/4 test",
+               `<a href="http://localhost:3000/gogits/gogs/issues/4" class="ref-issue">#4</a> test`)
+       test("http://localhost:3000/gogits/gogs/issues/4?a=1&b=2#comment-123 test",
+               `<a href="http://localhost:3000/gogits/gogs/issues/4?a=1&amp;b=2#comment-123" class="ref-issue">#4</a> test`)
 }
 
 func TestRegExp_sha1CurrentPattern(t *testing.T) {
index 8d9858f0df3099551431159a77423751db927622..e86e2d9f99dba68332f0d0a6ff6b29cb973df9c7 100644 (file)
 
   .task-list-item {
     list-style-type: none;
+    position: relative;
 
     input[type="checkbox"] {
-      margin: 0 6px .25em -1.6em;
+      position: absolute;
+      top: .25em;
+      left: -1.6em;
     }
   }