aboutsummaryrefslogtreecommitdiff
path: root/test/Tests/Readers
diff options
context:
space:
mode:
authorGautier DI FOLCO <gautier.difolco@gmail.com>2021-01-17 01:15:33 +0100
committerGitHub <noreply@github.com>2021-01-16 16:15:33 -0800
commit6efd3460a776620fdb93812daa4f6831e6c332ce (patch)
tree0d6dfc64a0690efd03f9abfd6b8cf3004f5e19d1 /test/Tests/Readers
parent83336a45a78b288dcc0104d2432135bdb3f5e8f1 (diff)
downloadpandoc-6efd3460a776620fdb93812daa4f6831e6c332ce.tar.gz
Markdown reader: support GitHub wiki's internal links (#2923) (#6458)
Canges overview: * Add a `Ext_markdown_github_wikilink` constructor to `Extension` [API change]. * Add the parser `githubWikiLink` in `Text.Pandoc.Readers.Markdown` * Add tests.
Diffstat (limited to 'test/Tests/Readers')
-rw-r--r--test/Tests/Readers/Markdown.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Tests/Readers/Markdown.hs b/test/Tests/Readers/Markdown.hs
index 18f909583..a2abcb143 100644
--- a/test/Tests/Readers/Markdown.hs
+++ b/test/Tests/Readers/Markdown.hs
@@ -307,6 +307,36 @@ tests = [ testGroup "inline code"
"[https://example.org(](url)" =?>
para (link "url" "" (text "https://example.org("))
]
+ , testGroup "Github wiki links"
+ [ test markdownGH "autolink" $
+ "[[https://example.org]]" =?>
+ para (link "https://example.org" "wikilink" (text "https://example.org"))
+ , test markdownGH "link with title" $
+ "[[title|https://example.org]]" =?>
+ para (link "https://example.org" "wikilink" (text "title"))
+ , test markdownGH "bad link with title" $
+ "[[title|random string]]" =?>
+ para (link "random-string" "wikilink" (text "title"))
+ , test markdownGH "autolink not being a link" $
+ "[[Name of page]]" =?>
+ para (link "Name-of-page" "wikilink" (text "Name of page"))
+ , test markdownGH "autolink not being a link with a square bracket" $
+ "[[Name of ]page]]" =?>
+ para (link "Name-of-]page" "wikilink" (text "Name of ]page"))
+ , test markdownGH "formatting (strong and emphasis) should not be interpreted" $
+ "[[***a**b **c**d*|https://example.org]]" =?>
+ para (text "[[" <> emph (strong (str "a") <> str "b" <> space
+ <> strong (str "c") <> str "d") <> text "|https://example.org]]")
+ , test markdownGH "inlined code should not make a link" $
+ "[[ti`|`le|https://example.org]]" =?>
+ para (text "[[ti" <> code "|" <> text "le|https://example.org]]")
+ , test markdownGH "link with title and a cut should take the middle part as link" $
+ "[[tit|le|https://example.org]]" =?>
+ para (link "le" "wikilink" (text "tit"))
+ , test markdownGH "link with inline start should be a link" $
+ "[[t`i*t_le|https://example.org]]" =?>
+ para (link "https://example.org" "wikilink" (text "t`i*t_le"))
+ ]
, testGroup "Headers"
[ "blank line before header" =:
"\n# Header\n"