git.iko.soy/typeable/pandoc
on master help sign in
Revert "Markdown reader: support GitHub wiki's internal links (#2923) (#6458)"
c841bcfJohn MacFarlane
src/Text/Pandoc/Extensions.hs−3
@@ -118,7 +118,6 @@ data Extension =
118 | Ext_literate_haskell -- ^ Enable literate Haskell conventions
118 | Ext_literate_haskell -- ^ Enable literate Haskell conventions
119 | Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown iff
119 | Ext_markdown_attribute -- ^ Interpret text inside HTML as markdown iff
120 -- container has attribute 'markdown'
120 -- container has attribute 'markdown'
121− | Ext_wikilinks -- ^ Interpret a markdown wiki link
122 | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks
121 | Ext_markdown_in_html_blocks -- ^ Interpret as markdown inside HTML blocks
123 | Ext_mmd_header_identifiers -- ^ Multimarkdown style header identifiers [myid]
122 | Ext_mmd_header_identifiers -- ^ Multimarkdown style header identifiers [myid]
124 | Ext_mmd_link_attributes -- ^ MMD style reference link attributes
123 | Ext_mmd_link_attributes -- ^ MMD style reference link attributes
@@ -259,7 +258,6 @@ githubMarkdownExtensions = extensionsFromList
259 , Ext_emoji
258 , Ext_emoji
260 , Ext_fenced_code_blocks
259 , Ext_fenced_code_blocks
261 , Ext_backtick_code_blocks
260 , Ext_backtick_code_blocks
262− , Ext_wikilinks
263 ]
261 ]
264
262
265-- | Extensions to be used with multimarkdown.
263-- | Extensions to be used with multimarkdown.
@@ -446,7 +444,6 @@ getAllExtensions f = universalExtensions <> getAll f
446 , Ext_tex_math_single_backslash
444 , Ext_tex_math_single_backslash
447 , Ext_tex_math_double_backslash
445 , Ext_tex_math_double_backslash
448 , Ext_markdown_attribute
446 , Ext_markdown_attribute
449− , Ext_wikilinks
450 , Ext_mmd_title_block
447 , Ext_mmd_title_block
451 , Ext_abbreviations
448 , Ext_abbreviations
452 , Ext_autolink_bare_uris
449 , Ext_autolink_bare_uris
src/Text/Pandoc/Readers/Markdown.hs−25
@@ -21,7 +21,6 @@ module Text.Pandoc.Readers.Markdown (
21import Control.Monad
21import Control.Monad
22import Control.Monad.Except (throwError)
22import Control.Monad.Except (throwError)
23import Data.Char (isAlphaNum, isPunctuation, isSpace)
23import Data.Char (isAlphaNum, isPunctuation, isSpace)
24−import Data.Functor (($>))
25import Data.List (transpose, elemIndex, sortOn)
24import Data.List (transpose, elemIndex, sortOn)
26import qualified Data.Map as M
25import qualified Data.Map as M
27import Data.Maybe
26import Data.Maybe
@@ -1486,7 +1485,6 @@ inline = choice [ whitespace
1486 , note
1485 , note
1487 , cite
1486 , cite
1488 , bracketedSpan
1487 , bracketedSpan
1489− , githubWikiLink
1490 , link
1488 , link
1491 , image
1489 , image
1492 , math
1490 , math
@@ -1782,29 +1780,6 @@ source = do
1782linkTitle :: PandocMonad m => MarkdownParser m Text
1780linkTitle :: PandocMonad m => MarkdownParser m Text
1783linkTitle = quotedTitle '"' <|> quotedTitle '\''
1781linkTitle = quotedTitle '"' <|> quotedTitle '\''
1784
1782
1785−-- Github wiki style link, with optional title
1786−-- syntax documented under https://help.github.com/en/github/building-a-strong-community/editing-wiki-content
1787−githubWikiLink :: PandocMonad m => MarkdownParser m (F Inlines)
1788−githubWikiLink = try $ guardEnabled Ext_wikilinks >> wikilink
1789− where
1790− wikilink = try $ do
1791− string "[["
1792− firstPart <- fmap mconcat . sequence <$> wikiText
1793− (char '|' *> complexWikilink firstPart)
1794− <|> (string "]]" $> (B.link
1795− <$> (stringify <$> firstPart)
1796− <*> return "wikilink"
1797− <*> firstPart))
1798−
1799− complexWikilink firstPart = do
1800− url <- fmap stringify . sequence <$> wikiText
1801− string "]]"
1802− return $ B.link <$> url
1803− <*> return "wikilink"
1804− <*> firstPart
1805−
1806− wikiText = many (whitespace <|> bareURL <|> str <|> endline <|> escapedChar)
1807−
1808link :: PandocMonad m => MarkdownParser m (F Inlines)
1783link :: PandocMonad m => MarkdownParser m (F Inlines)
1809link = try $ do
1784link = try $ do
1810 st <- getState
1785 st <- getState
test/Tests/Readers/Markdown.hs−30
@@ -307,36 +307,6 @@ tests = [ testGroup "inline code"
307 "[https://example.org(](url)" =?>
307 "[https://example.org(](url)" =?>
308 para (link "url" "" (text "https://example.org("))
308 para (link "url" "" (text "https://example.org("))
309 ]
309 ]
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− ]
340 , testGroup "Headers"
310 , testGroup "Headers"
341 [ "blank line before header" =:
311 [ "blank line before header" =:
342 "\n# Header\n"
312 "\n# Header\n"