diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2022-12-15 21:19:48 +0100 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2023-01-15 10:46:55 -0800 |
| commit | ca6d4bfa490349e7a4dfeee05119427a1c5ace6c (patch) | |
| tree | 462ab8e861e5447cb72f68b4d186780514c90f2c /src/Text/Pandoc/Extensions.hs | |
| parent | c71d476fa6126a6fe9095c67838e452956249df4 (diff) | |
Markdown, CommonMark: add support for wiki links. [API change]
Adds the Markdown/CommonMark extensions `wikilinks_title_after_pipe` and
`wikilinks_title_before_pipe`. The former enables links of style `[[Name
of page|Title]]` and the latter `[[Title|Name of page]]`. Titles are
optional in both variants, so this works for both:
`[[https://example.org]]`, `[[Name of page]]`.
The writer is modified to render links with title `wikilink` as a
wikilink if a respective extension is enabled.
Pandoc will use `wikilinks_title_after_pipe` if both extensions are
enabled.
Closes: #2923
Diffstat (limited to 'src/Text/Pandoc/Extensions.hs')
| -rw-r--r-- | src/Text/Pandoc/Extensions.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index 525e96ac6..97ac8e77a 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -135,6 +135,10 @@ data Extension = | Ext_tex_math_dollars -- ^ TeX math between $..$ or $$..$$ | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\] | Ext_tex_math_single_backslash -- ^ TeX math btw \(..\) \[..\] + | Ext_wikilinks_title_after_pipe -- ^ Support wikilinks of style + -- [[target|title]] + | Ext_wikilinks_title_before_pipe -- ^ Support wikilinks of style + -- [[title|target]] | Ext_xrefs_name -- ^ Use xrefs with names | Ext_xrefs_number -- ^ Use xrefs with numbers | Ext_yaml_metadata_block -- ^ YAML metadata block @@ -505,6 +509,8 @@ getAllExtensions f = universalExtensions <> getAll f , Ext_literate_haskell , Ext_short_subsuperscripts , Ext_rebase_relative_paths + , Ext_wikilinks_title_after_pipe + , Ext_wikilinks_title_before_pipe ] getAll "markdown_strict" = allMarkdownExtensions getAll "markdown_phpextra" = allMarkdownExtensions @@ -557,6 +563,8 @@ getAllExtensions f = universalExtensions <> getAll f , Ext_implicit_header_references , Ext_attributes , Ext_sourcepos + , Ext_wikilinks_title_after_pipe + , Ext_wikilinks_title_before_pipe , Ext_yaml_metadata_block , Ext_rebase_relative_paths ] |
