@ -85,8 +85,89 @@ func TestRender_Images(t *testing.T) {
` <p><a href=" ` + href + ` " rel="nofollow"><img src=" ` + result + ` " alt=" ` + title + ` "/></a></p> ` )
}
func testAnswers ( baseURL string ) [ ] string {
return [ ] string {
func TestTotal_RenderString ( t * testing . T ) {
defer test . MockVariableValue ( & markup . RenderBehaviorForTesting . DisableAdditionalAttributes , true ) ( )
// Test cases without ambiguous links (It is not right to copy a whole file here, instead it should clearly test what is being tested)
sameCases := [ ] string {
// dear imgui wiki markdown extract: special wiki syntax
` Wiki ! Enjoy : )
- [ [ Links , Language bindings , Engine bindings | Links ] ]
- [ [ Tips ] ]
See commit 65 f1bf27bc
Ideas and codes
- Bezier widget ( by @ r - lyeh ) ` + AppURL + ` ocornut / imgui / issues / 786
- Bezier widget ( by @ r - lyeh ) ` + FullURL + ` issues / 786
- Node graph editors https : //github.com/ocornut/imgui/issues/306
- [ [ Memory Editor | memory_editor_example ] ]
- [ [ Plot var helper | plot_var_example ] ] ` ,
// wine-staging wiki home extract: tables, special wiki syntax, images
` # # What is Wine Staging ?
* * Wine Staging * * on website [ wine - staging . com ] ( http : //wine-staging.com).
# # Quick Links
Here are some links to the most important topics . You can find the full list of pages at the sidebar .
| [ [ images / icon - install . png ] ] | [ [ Installation ] ] |
| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| [ [ images / icon - usage . png ] ] | [ [ Usage ] ] |
` ,
// libgdx wiki page: inline images with special syntax
` [ Excelsior JET ] ( http : //www.excelsiorjet.com/) allows you to create native executables for Windows, Linux and Mac OS X.
1. [ Package your libGDX application ] ( https : //github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop)
[ [ images / 1. png ] ]
2. Perform a test run by hitting the Run ! button .
[ [ images / 2. png ] ]
# # More tests { # custom - id }
( from https : //www.markdownguide.org/extended-syntax/)
# # # Checkboxes
- [ ] unchecked
- [ x ] checked
- [ ] still unchecked
# # # Definition list
First Term
: This is the definition of the first term .
Second Term
: This is one definition of the second term .
: This is another definition of the second term .
# # # Footnotes
Here is a simple footnote , [ ^ 1 ] and here is a longer one . [ ^ bignote ]
[ ^ 1 ] : This is the first footnote .
[ ^ bignote ] : Here is one with multiple paragraphs and code .
Indent paragraphs to include them in the footnote .
` + " ` { my code } ` " + `
Add as many paragraphs as you like .
` ,
`
- [ ] < ! -- rebase - check -- > If you want to rebase / retry this PR , click this checkbox .
-- -
This PR has been generated by [ Renovate Bot ] ( https : //github.com/renovatebot/renovate).
< ! -- test - comment -- > ` ,
}
baseURL := ""
testAnswers := [ ] string {
` < p > Wiki ! Enjoy : ) < / p >
< ul >
< li > < a href = "` + baseURL + `/Links" rel = "nofollow" > Links , Language bindings , Engine bindings < / a > < / li >
@ -123,9 +204,9 @@ func testAnswers(baseURL string) []string {
` ,
` < p > < a href = "http://www.excelsiorjet.com/" rel = "nofollow" > Excelsior JET < / a > allows you to create native executables for Windows , Linux and Mac OS X . < / p >
< ol >
< li > < a href = "https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop" rel = "nofollow" > Package your libGDX application < / a > < br / >
< li > < a href = "https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop" rel = "nofollow" > Package your libGDX application < / a >
< a href = "` + baseURL + `/images/1.png" rel = "nofollow" > < img src = "` + baseURL + `/images/1.png" title = "1.png" alt = "images/1.png" / > < / a > < / li >
< li > Perform a test run by hitting the Run ! button . < br / >
< li > Perform a test run by hitting the Run ! button .
< a href = "` + baseURL + `/images/2.png" rel = "nofollow" > < img src = "` + baseURL + `/images/2.png" title = "2.png" alt = "images/2.png" / > < / a > < / li >
< / ol >
< h2 id = "user-content-custom-id" > More tests < / h2 >
@ -160,106 +241,24 @@ func testAnswers(baseURL string) []string {
< / li >
< / ol >
< / div >
` , ` < ul >
` ,
` < ul >
< li class = "task-list-item" > < input type = "checkbox" disabled = "" data - source - position = "3" / > If you want to rebase / retry this PR , click this checkbox . < / li >
< / ul >
< hr / >
< p > This PR has been generated by < a href = "https://github.com/renovatebot/renovate" rel = "nofollow" > Renovate Bot < / a > . < / p >
` ,
}
}
// Test cases without ambiguous links
var sameCases = [ ] string {
// dear imgui wiki markdown extract: special wiki syntax
` Wiki ! Enjoy : )
- [ [ Links , Language bindings , Engine bindings | Links ] ]
- [ [ Tips ] ]
See commit 65 f1bf27bc
Ideas and codes
- Bezier widget ( by @ r - lyeh ) ` + AppURL + ` ocornut / imgui / issues / 786
- Bezier widget ( by @ r - lyeh ) ` + FullURL + ` issues / 786
- Node graph editors https : //github.com/ocornut/imgui/issues/306
- [ [ Memory Editor | memory_editor_example ] ]
- [ [ Plot var helper | plot_var_example ] ] ` ,
// wine-staging wiki home extract: tables, special wiki syntax, images
` # # What is Wine Staging ?
* * Wine Staging * * on website [ wine - staging . com ] ( http : //wine-staging.com).
# # Quick Links
Here are some links to the most important topics . You can find the full list of pages at the sidebar .
| [ [ images / icon - install . png ] ] | [ [ Installation ] ] |
| -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
| [ [ images / icon - usage . png ] ] | [ [ Usage ] ] |
` ,
// libgdx wiki page: inline images with special syntax
` [ Excelsior JET ] ( http : //www.excelsiorjet.com/) allows you to create native executables for Windows, Linux and Mac OS X.
1. [ Package your libGDX application ] ( https : //github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-for-the-desktop)
[ [ images / 1. png ] ]
2. Perform a test run by hitting the Run ! button .
[ [ images / 2. png ] ]
# # More tests { # custom - id }
( from https : //www.markdownguide.org/extended-syntax/)
# # # Checkboxes
- [ ] unchecked
- [ x ] checked
- [ ] still unchecked
# # # Definition list
First Term
: This is the definition of the first term .
Second Term
: This is one definition of the second term .
: This is another definition of the second term .
# # # Footnotes
Here is a simple footnote , [ ^ 1 ] and here is a longer one . [ ^ bignote ]
[ ^ 1 ] : This is the first footnote .
[ ^ bignote ] : Here is one with multiple paragraphs and code .
Indent paragraphs to include them in the footnote .
` + " ` { my code } ` " + `
Add as many paragraphs as you like .
` ,
`
- [ ] < ! -- rebase - check -- > If you want to rebase / retry this PR , click this checkbox .
-- -
This PR has been generated by [ Renovate Bot ] ( https : //github.com/renovatebot/renovate).
< ! -- test - comment -- > ` ,
}
func TestTotal_RenderString ( t * testing . T ) {
defer test . MockVariableValue ( & markup . RenderBehaviorForTesting . ForceHardLineBreak , true ) ( )
defer test . MockVariableValue ( & markup . RenderBehaviorForTesting . DisableAdditionalAttributes , true ) ( )
markup . Init ( & markup . RenderHelperFuncs {
IsUsernameMentionable : func ( ctx context . Context , username string ) bool {
return username == "r-lyeh"
} ,
} )
answers := testAnswers ( "" )
for i := 0 ; i < len ( sameCases ) ; i ++ {
line , err := markdown . RenderString ( markup . NewTestRenderContext ( localMetas ) , sameCases [ i ] )
assert . NoError ( t , err )
assert . Equal ( t , a nswers[ i ] , string ( line ) )
assert . Equal ( t , testAnswers [ i ] , string ( line ) )
}
}
@ -312,10 +311,9 @@ func TestRenderSiblingImages_Issue12925(t *testing.T) {
testcase := ` ! [ image1 ] ( / image1 )
! [ image2 ] ( / image2 )
`
expected := ` < p > < a href = "/image1" target = "_blank" rel = "nofollow noopener" > < img src = "/image1" alt = "image1" > < / a > < br >
expected := ` < p > < a href = "/image1" target = "_blank" rel = "nofollow noopener" > < img src = "/image1" alt = "image1" > < / a >
< a href = "/image2" target = "_blank" rel = "nofollow noopener" > < img src = "/image2" alt = "image2" > < / a > < / p >
`
defer test . MockVariableValue ( & markup . RenderBehaviorForTesting . ForceHardLineBreak , true ) ( )
res , err := markdown . RenderRawString ( markup . NewTestRenderContext ( ) , testcase )
assert . NoError ( t , err )
assert . Equal ( t , expected , res )
@ -525,43 +523,33 @@ mail@domain.com
space $ { SPACE } $ { SPACE }
`
input = strings . ReplaceAll ( input , "${SPACE}" , " " ) // replace ${SPACE} with " ", to avoid some editor's auto-trimming
cases := [ ] struct {
Expected string
} {
{
Expected : ` < p > space @ mention - user < br / >
/ just / a / path . bin < br / >
< a href = "https://example.com/file.bin" rel = "nofollow" > https : //example.com/file.bin</a><br/>
< a href = "/file.bin" rel = "nofollow" > local link < / a > < br / >
< a href = "https://example.com" rel = "nofollow" > remote link < / a > < br / >
< a href = "/file.bin" rel = "nofollow" > local link < / a > < br / >
< a href = "https://example.com" rel = "nofollow" > remote link < / a > < br / >
< a href = "/image.jpg" target = "_blank" rel = "nofollow noopener" > < img src = "/image.jpg" alt = "local image" / > < / a > < br / >
< a href = "/path/file" target = "_blank" rel = "nofollow noopener" > < img src = "/path/file" alt = "local image" / > < / a > < br / >
< a href = "/path/file" target = "_blank" rel = "nofollow noopener" > < img src = "/path/file" alt = "local image" / > < / a > < br / >
< a href = "https://example.com/image.jpg" target = "_blank" rel = "nofollow noopener" > < img src = "https://example.com/image.jpg" alt = "remote image" / > < / a > < br / >
< a href = "/image.jpg" rel = "nofollow" > < img src = "/image.jpg" title = "local image" alt = "local image" / > < / a > < br / >
< a href = "https://example.com/image.jpg" rel = "nofollow" > < img src = "https://example.com/image.jpg" title = "remote link" alt = "remote link" / > < / a > < br / >
< a href = "https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash" rel = "nofollow" > < code > 88 fc37a3c0 ... 12 fc37a3c0 ( hash ) < / code > < / a > < br / >
com 88 fc37a3c0a4dda553bdcfc80c178a58247f42fb ... 12 fc37a3c0a4dda553bdcfc80c178a58247f42fb pare < br / >
< a href = "https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb" rel = "nofollow" > < code > 88 fc37a3c0 < / code > < / a > < br / >
com 88 fc37a3c0a4dda553bdcfc80c178a58247f42fb mit < br / >
< span class = "emoji" aria - label = "thumbs up" > 👍 < / span > < br / >
< a href = "mailto:mail@domain.com" rel = "nofollow" > mail @ domain . com < / a > < br / >
@ mention - user test < br / >
# 123 < br / >
expected := ` < p > space @ mention - user < br / >
/ just / a / path . bin
< a href = "https://example.com/file.bin" rel = "nofollow" > https : //example.com/file.bin</a>
< a href = "/file.bin" rel = "nofollow" > local link < / a >
< a href = "https://example.com" rel = "nofollow" > remote link < / a >
< a href = "/file.bin" rel = "nofollow" > local link < / a >
< a href = "https://example.com" rel = "nofollow" > remote link < / a >
< a href = "/image.jpg" target = "_blank" rel = "nofollow noopener" > < img src = "/image.jpg" alt = "local image" / > < / a >
< a href = "/path/file" target = "_blank" rel = "nofollow noopener" > < img src = "/path/file" alt = "local image" / > < / a >
< a href = "/path/file" target = "_blank" rel = "nofollow noopener" > < img src = "/path/file" alt = "local image" / > < / a >
< a href = "https://example.com/image.jpg" target = "_blank" rel = "nofollow noopener" > < img src = "https://example.com/image.jpg" alt = "remote image" / > < / a >
< a href = "/image.jpg" rel = "nofollow" > < img src = "/image.jpg" title = "local image" alt = "local image" / > < / a >
< a href = "https://example.com/image.jpg" rel = "nofollow" > < img src = "https://example.com/image.jpg" title = "remote link" alt = "remote link" / > < / a >
< a href = "https://example.com/user/repo/compare/88fc37a3c0a4dda553bdcfc80c178a58247f42fb...12fc37a3c0a4dda553bdcfc80c178a58247f42fb#hash" rel = "nofollow" > < code > 88 fc37a3c0 ... 12 fc37a3c0 ( hash ) < / code > < / a >
com 88 fc37a3c0a4dda553bdcfc80c178a58247f42fb ... 12 fc37a3c0a4dda553bdcfc80c178a58247f42fb pare
< a href = "https://example.com/user/repo/commit/88fc37a3c0a4dda553bdcfc80c178a58247f42fb" rel = "nofollow" > < code > 88 fc37a3c0 < / code > < / a >
com 88 fc37a3c0a4dda553bdcfc80c178a58247f42fb mit
< span class = "emoji" aria - label = "thumbs up" > 👍 < / span >
< a href = "mailto:mail@domain.com" rel = "nofollow" > mail @ domain . com < / a >
@ mention - user test
# 123
space < / p >
` ,
} ,
}
defer test . MockVariableValue ( & markup . RenderBehaviorForTesting . ForceHardLineBreak , true ) ( )
`
defer test . MockVariableValue ( & markup . RenderBehaviorForTesting . DisableAdditionalAttributes , true ) ( )
for i , c := range cases {
result , err := markdown . RenderString ( markup . NewTestRenderContext ( localMetas ) , input )
assert . NoError ( t , err , "Unexpected error in testcase: %v" , i )
assert . Equal ( t , c . Expected , string ( result ) , "Unexpected result in testcase %v" , i )
}
assert . NoError ( t , err )
assert . Equal ( t , expected , string ( result ) )
}
func TestAttention ( t * testing . T ) {