@@ -307,6 +307,36 @@ tests = [ testGroup "inline code"
307307 "[https://example.org(](url)" =?>
308308 para (link "url" "" (text "https://example.org("))
309309 ]
310+ , testGroup "Github wiki links"
311+ [ test markdownGH "autolink" $
312+ "[[https://example.org]]" =?>
313+ para (link "https://example.org" "wikilink" (text "https://example.org"))
314+ , test markdownGH "link with title" $
315+ "[[title|https://example.org]]" =?>
316+ para (link "https://example.org" "wikilink" (text "title"))
317+ , test markdownGH "bad link with title" $
318+ "[[title|random string]]" =?>
319+ para (link "random-string" "wikilink" (text "title"))
320+ , test markdownGH "autolink not being a link" $
321+ "[[Name of page]]" =?>
322+ para (link "Name-of-page" "wikilink" (text "Name of page"))
323+ , test markdownGH "autolink not being a link with a square bracket" $
324+ "[[Name of ]page]]" =?>
325+ para (link "Name-of-]page" "wikilink" (text "Name of ]page"))
326+ , test markdownGH "formatting (strong and emphasis) should not be interpreted" $
327+ "[[***a**b **c**d*|https://example.org]]" =?>
328+ para (text "[[" <> emph (strong (str "a") <> str "b" <> space
329+ <> strong (str "c") <> str "d") <> text "|https://example.org]]")
330+ , test markdownGH "inlined code should not make a link" $
331+ "[[ti`|`le|https://example.org]]" =?>
332+ para (text "[[ti" <> code "|" <> text "le|https://example.org]]")
333+ , test markdownGH "link with title and a cut should take the middle part as link" $
334+ "[[tit|le|https://example.org]]" =?>
335+ para (link "le" "wikilink" (text "tit"))
336+ , test markdownGH "link with inline start should be a link" $
337+ "[[t`i*t_le|https://example.org]]" =?>
338+ para (link "https://example.org" "wikilink" (text "t`i*t_le"))
339+ ]
310340 , testGroup "Headers"
311341 [ "blank line before header" =:
312342 "\n# Header\n"