-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
markup/goldmark: Support auto links in render hook
Fixes #8755
- Loading branch information
Showing
3 changed files
with
91 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,6 @@ title: P1 | |
b.AssertFileContent("public/p1/index.html", `Link First Link|PARTIAL1_EDITED PARTIAL2_EDITEDEND`) | ||
} | ||
|
||
|
||
func TestRenderHooks(t *testing.T) { | ||
config := ` | ||
baseURL="https://example.org" | ||
|
@@ -110,6 +109,10 @@ title: Cool Page | |
--- | ||
[First Link](https://www.google.com "Google's Homepage") | ||
<https://foo.bar/> | ||
https://bar.baz/ | ||
<[email protected]> | ||
<mailto:[email protected]> | ||
{{< myshortcode3 >}} | ||
|
@@ -209,7 +212,11 @@ title: No Template | |
b.Assert(int(counters.contentRenderCounter), qt.Equals, 45) | ||
|
||
b.AssertFileContent("public/blog/p1/index.html", ` | ||
<p>Cool Page|https://www.google.com|Title: Google's Homepage|Text: First Link|END</p> | ||
Cool Page|https://www.google.com|Title: Google's Homepage|Text: First Link|END | ||
Cool Page|https://foo.bar/|Title: |Text: https://foo.bar/|END | ||
Cool Page|https://bar.baz/|Title: |Text: https://bar.baz/|END | ||
Cool Page|mailto:[email protected]|Title: |Text: [email protected]|END | ||
Cool Page|mailto:[email protected]|Title: |Text: mailto:[email protected]|END | ||
Text: Second | ||
SHORT3| | ||
<p>IMAGE: Cool Page||/images/Dragster.jpg|Title: image title|Text: Drag Racing|END</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
package goldmark | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"testing" | ||
|
||
|
@@ -59,6 +60,10 @@ https://github.com/gohugoio/hugo/issues/6528 | |
[Live Demo here!](https://docuapi.netlify.com/) | ||
[I'm an inline-style link with title](https://www.google.com "Google's Homepage") | ||
<https://foo.bar/> | ||
https://bar.baz/ | ||
<[email protected]> | ||
<mailto:[email protected]> | ||
## Code Fences | ||
|
@@ -132,8 +137,14 @@ description | |
b := convert(c, mconf, content) | ||
got := string(b.Bytes()) | ||
|
||
fmt.Println(got) | ||
|
||
// Links | ||
// c.Assert(got, qt.Contains, `<a href="https://docuapi.netlify.com/">Live Demo here!</a>`) | ||
c.Assert(got, qt.Contains, `<a href="https://docuapi.netlify.com/">Live Demo here!</a>`) | ||
c.Assert(got, qt.Contains, `<a href="https://foo.bar/">https://foo.bar/</a>`) | ||
c.Assert(got, qt.Contains, `<a href="https://bar.baz/">https://bar.baz/</a>`) | ||
c.Assert(got, qt.Contains, `<a href="mailto:[email protected]">[email protected]</a>`) | ||
c.Assert(got, qt.Contains, `<a href="mailto:[email protected]">mailto:[email protected]</a></p>`) | ||
|
||
// Header IDs | ||
c.Assert(got, qt.Contains, `<h2 id="custom">Custom ID</h2>`, qt.Commentf(got)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters