diff --git a/modules/markup/html.go b/modules/markup/html.go
index 3355c021ce..ca9857d2bf 100644
--- a/modules/markup/html.go
+++ b/modules/markup/html.go
@@ -759,9 +759,6 @@ func shortLinkProcessor(ctx *RenderContext, node *html.Node) {
title = path.Base(name)
}
alt := props["alt"]
- if alt == "" {
- alt = name
- }
// make the childNode an image - if we can, we also place the alt
childNode.Type = html.ElementNode
@@ -772,9 +769,6 @@ func shortLinkProcessor(ctx *RenderContext, node *html.Node) {
{Key: "title", Val: title},
{Key: "alt", Val: alt},
}
- if alt == "" {
- childNode.Attr = childNode.Attr[:2]
- }
} else {
if !absoluteLink {
if ctx.IsWiki {
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go
index 05ba321548..6c00c5e7c8 100644
--- a/modules/markup/html_test.go
+++ b/modules/markup/html_test.go
@@ -416,7 +416,7 @@ func TestRender_ShortLinks(t *testing.T) {
otherImgurlWiki := util.URLJoin(markup.TestRepoURL, "wiki", "raw", "Link+Other.jpg")
encodedImgurlWiki := util.URLJoin(markup.TestRepoURL, "wiki", "raw", "Link+%23.jpg")
notencodedImgurlWiki := util.URLJoin(markup.TestRepoURL, "wiki", "raw", "some", "path", "Link+#.jpg")
- favicon := "http://google.com/favicon.ico"
+ favicon := "https://forgejo.org/favicon.ico"
test(
"[[Link]]",
@@ -424,28 +424,28 @@ func TestRender_ShortLinks(t *testing.T) {
`
Link
`)
test(
"[[Link.jpg]]",
- `
`,
- `
`)
+ `
`,
+ `
`)
test(
"[["+favicon+"]]",
- `
`,
- `
`)
+ `
`,
+ `
`)
test(
"[[Name|Link]]",
`Name
`,
`Name
`)
test(
"[[Name|Link.jpg]]",
- `
`,
- `
`)
+ `
`,
+ `
`)
test(
"[[Name|Link.jpg|alt=AltName]]",
`
`,
`
`)
test(
"[[Name|Link.jpg|title=Title]]",
- `
`,
- `
`)
+ `
`,
+ `
`)
test(
"[[Name|Link.jpg|alt=AltName|title=Title]]",
`
`,
@@ -472,16 +472,16 @@ func TestRender_ShortLinks(t *testing.T) {
`Link Other Link Link?
`)
test(
"[[Link #.jpg]]",
- `
`,
- `
`)
+ `
`,
+ `
`)
test(
"[[Name|Link #.jpg|alt=\"AltName\"|title='Title']]",
`
`,
`
`)
test(
"[[some/path/Link #.jpg]]",
- `
`,
- `
`)
+ `
`,
+ `
`)
test(
"[[foobar]]
",
`[[foobar]]
`,
diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go
index 4c9ab42806..e64ab6a6f4 100644
--- a/modules/markup/markdown/markdown_test.go
+++ b/modules/markup/markdown/markdown_test.go
@@ -108,7 +108,7 @@ func TestRender_Images(t *testing.T) {
test(
"[["+title+"|"+url+"]]",
- `
`)
+ `
`)
test(
"[]("+href+")",
`
`)
@@ -119,7 +119,7 @@ func TestRender_Images(t *testing.T) {
test(
"[["+title+"|"+url+"]]",
- `
`)
+ `
`)
test(
"[]("+href+")",
`
`)
@@ -149,13 +149,13 @@ func testAnswers(baseURLContent, baseURLImages string) []string {
- |
+ |
Installation |
- |
+ |
Usage |
@@ -164,9 +164,9 @@ func testAnswers(baseURLContent, baseURLImages string) []string {
`Excelsior JET allows you to create native executables for Windows, Linux and Mac OS X.
- Package your libGDX application
-
+
- Perform a test run by hitting the Run! button.
-
+
More tests
(from https://www.markdownguide.org/extended-syntax/)
@@ -849,8 +849,8 @@ mail@domain.com



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -876,8 +876,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -905,8 +905,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -934,8 +934,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -963,8 +963,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -992,8 +992,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -1022,8 +1022,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -1052,8 +1052,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -1082,8 +1082,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -1112,8 +1112,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -1143,8 +1143,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
@@ -1174,8 +1174,8 @@ space



-
-
+
+
https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb
diff --git a/modules/templates/util_render_test.go b/modules/templates/util_render_test.go
index 3479d94039..028cd2ba76 100644
--- a/modules/templates/util_render_test.go
+++ b/modules/templates/util_render_test.go
@@ -194,8 +194,8 @@ func TestRenderMarkdownToHtml(t *testing.T) {
remote link
-
-
+
+
88fc37a3c0...12fc37a3c0 (hash)
com 88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
88fc37a3c0