From 0aed9dd589189a9bbe5cae99e0e024e2d4a92c36 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 5 May 2020 23:01:50 -0700 Subject: Add commonmark_x output format... commonmark with a number of useful extensions (more than gfm). --- src/Text/Pandoc/Extensions.hs | 34 +++++++++++++++++++++++++++++++--- src/Text/Pandoc/Readers.hs | 1 + src/Text/Pandoc/Templates.hs | 1 + src/Text/Pandoc/Writers.hs | 1 + 4 files changed, 34 insertions(+), 3 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index 2b7cfca7e..3db2db4e5 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -338,6 +338,29 @@ getDefaultExtensions "plain" = plainExtensions getDefaultExtensions "gfm" = githubMarkdownExtensions getDefaultExtensions "commonmark" = extensionsFromList [Ext_raw_html] +getDefaultExtensions "commonmark_x" = extensionsFromList + [ Ext_pipe_tables + , Ext_raw_html + , Ext_auto_identifiers + , Ext_strikeout + , Ext_task_lists + , Ext_emoji + , Ext_pipe_tables + , Ext_raw_html + , Ext_raw_tex -- only supported in writer (for math) + , Ext_smart + , Ext_tex_math_dollars + , Ext_superscript + , Ext_subscript + , Ext_definition_lists + , Ext_footnotes + , Ext_fancy_lists + , Ext_fenced_divs + , Ext_bracketed_spans + , Ext_raw_attribute + , Ext_implicit_header_references + , Ext_attributes + ] getDefaultExtensions "org" = extensionsFromList [Ext_citations, Ext_auto_identifiers] @@ -433,10 +456,16 @@ getAllExtensions f = universalExtensions <> getAll f [ Ext_amuse ] getAll "asciidoc" = autoIdExtensions getAll "plain" = allMarkdownExtensions - getAll "gfm" = githubMarkdownExtensions <> + getAll "gfm" = getAll "commonmark" + getAll "commonmark" = autoIdExtensions <> extensionsFromList - [ Ext_raw_html + [ Ext_pipe_tables + , Ext_autolink_bare_uris + , Ext_strikeout + , Ext_task_lists + , Ext_emoji + , Ext_raw_html , Ext_raw_tex -- only supported in writer (for math) , Ext_implicit_figures , Ext_hard_line_breaks @@ -453,7 +482,6 @@ getAllExtensions f = universalExtensions <> getAll f , Ext_implicit_header_references , Ext_attributes ] - getAll "commonmark" = getAll "gfm" getAll "org" = autoIdExtensions <> extensionsFromList [ Ext_citations diff --git a/src/Text/Pandoc/Readers.hs b/src/Text/Pandoc/Readers.hs index 5d33d494c..1337c742c 100644 --- a/src/Text/Pandoc/Readers.hs +++ b/src/Text/Pandoc/Readers.hs @@ -111,6 +111,7 @@ readers = [ ("native" , TextReader readNative) ,("markdown_github" , TextReader readMarkdown) ,("markdown_mmd", TextReader readMarkdown) ,("commonmark" , TextReader readCommonMark) + ,("commonmark_x" , TextReader readCommonMark) ,("creole" , TextReader readCreole) ,("dokuwiki" , TextReader readDokuWiki) ,("gfm" , TextReader readCommonMark) diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs index b95df23e7..1f253b465 100644 --- a/src/Text/Pandoc/Templates.hs +++ b/src/Text/Pandoc/Templates.hs @@ -97,6 +97,7 @@ getDefaultTemplate writer = do "markdown_mmd" -> getDefaultTemplate "markdown" "markdown_phpextra" -> getDefaultTemplate "markdown" "gfm" -> getDefaultTemplate "commonmark" + "commonmark_x" -> getDefaultTemplate "commonmark" _ -> do let fname = "templates" "default" <.> T.unpack format UTF8.toText <$> readDataFile fname diff --git a/src/Text/Pandoc/Writers.hs b/src/Text/Pandoc/Writers.hs index f4e667a87..df8355c32 100644 --- a/src/Text/Pandoc/Writers.hs +++ b/src/Text/Pandoc/Writers.hs @@ -178,6 +178,7 @@ writers = [ ,("asciidoctor" , TextWriter writeAsciiDoctor) ,("haddock" , TextWriter writeHaddock) ,("commonmark" , TextWriter writeCommonMark) + ,("commonmark_x" , TextWriter writeCommonMark) ,("gfm" , TextWriter writeCommonMark) ,("tei" , TextWriter writeTEI) ,("muse" , TextWriter writeMuse) -- cgit v1.2.3