{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{- |
   Module      : Text.Pandoc.Readers.CommonMark
   Copyright   : Copyright (C) 2015-2020 John MacFarlane
   License     : GNU GPL, version 2 or above

   Maintainer  : John MacFarlane <jgm@berkeley.edu>
   Stability   : alpha
   Portability : portable

Conversion of CommonMark-formatted plain text to 'Pandoc' document.

CommonMark is a strongly specified variant of Markdown: http://commonmark.org.
-}
module Text.Pandoc.Readers.CommonMark (readCommonMark)
where

import Commonmark
import Commonmark.Extensions
import Commonmark.Pandoc
import Data.Text (Text)
import Text.Pandoc.Class.PandocMonad (PandocMonad)
import Text.Pandoc.Definition
import Text.Pandoc.Builder as B
import Text.Pandoc.Options
import Text.Pandoc.Error
import Control.Monad.Except
import Data.Functor.Identity (runIdentity)

-- | Parse a CommonMark formatted string into a 'Pandoc' structure.
readCommonMark :: PandocMonad m => ReaderOptions -> Text -> m Pandoc
readCommonMark :: ReaderOptions -> Text -> m Pandoc
readCommonMark ReaderOptions
opts Text
s = do
  let res :: Either ParseError (Cm () Blocks)
res = Identity (Either ParseError (Cm () Blocks))
-> Either ParseError (Cm () Blocks)
forall a. Identity a -> a
runIdentity (Identity (Either ParseError (Cm () Blocks))
 -> Either ParseError (Cm () Blocks))
-> Identity (Either ParseError (Cm () Blocks))
-> Either ParseError (Cm () Blocks)
forall a b. (a -> b) -> a -> b
$
              SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> String -> Text -> Identity (Either ParseError (Cm () Blocks))
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il) =>
SyntaxSpec m il bl -> String -> Text -> m (Either ParseError bl)
commonmarkWith (((SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
  -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks))
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks))
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks))
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a b. (a -> b) -> a -> b
($) SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il) =>
SyntaxSpec m il bl
defaultSyntaxSpec [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
exts) String
"input" Text
s
  case Either ParseError (Cm () Blocks)
res of
    Left ParseError
err -> PandocError -> m Pandoc
forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError (PandocError -> m Pandoc) -> PandocError -> m Pandoc
forall a b. (a -> b) -> a -> b
$ Text -> ParseError -> PandocError
PandocParsecError Text
s ParseError
err
    Right (Cm Blocks
bls :: Cm () Blocks) -> Pandoc -> m Pandoc
forall (m :: * -> *) a. Monad m => a -> m a
return (Pandoc -> m Pandoc) -> Pandoc -> m Pandoc
forall a b. (a -> b) -> a -> b
$ Blocks -> Pandoc
B.doc Blocks
bls
 where
  exts :: [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
exts = [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il) =>
SyntaxSpec m il bl
hardLineBreaksSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_hard_line_breaks ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasQuoted il) =>
SyntaxSpec m il bl
smartPunctuationSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_smart ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasStrikethrough il) =>
SyntaxSpec m il bl
strikethroughSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_strikeout ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasSuperscript il) =>
SyntaxSpec m il bl
superscriptSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_superscript ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasSubscript il) =>
SyntaxSpec m il bl
subscriptSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_subscript ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasMath il) =>
SyntaxSpec m il bl
mathSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_tex_math_dollars ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il) =>
SyntaxSpec m il bl
fancyListSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_fancy_lists ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsInline il, IsBlock il bl, HasDiv bl) =>
SyntaxSpec m il bl
fencedDivSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_fenced_divs ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsInline il, HasSpan il) =>
SyntaxSpec m il bl
bracketedSpanSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_bracketed_spans ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl) =>
SyntaxSpec m il bl
rawAttributeSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_raw_attribute ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsInline il) =>
SyntaxSpec m il bl
attributesSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_attributes ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasPipeTable il bl) =>
SyntaxSpec m il bl
pipeTableSpec) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_pipe_tables ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
            -- see #6739
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il) =>
SyntaxSpec m il bl
autolinkSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_autolink_bare_uris ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasEmoji il) =>
SyntaxSpec m il bl
emojiSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_emoji ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, ToPlainText il) =>
SyntaxSpec m il bl
autoIdentifiersSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>)
           | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_gfm_auto_identifiers ReaderOptions
opts
           , Bool -> Bool
not (Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_ascii_identifiers ReaderOptions
opts) ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, ToPlainText il) =>
SyntaxSpec m il bl
autoIdentifiersAsciiSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>)
           | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_gfm_auto_identifiers ReaderOptions
opts
           , Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_ascii_identifiers ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il) =>
SyntaxSpec m il bl
implicitHeadingReferencesSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>)
           | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_implicit_header_references ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, Typeable m, IsBlock il bl, IsInline il, Typeable il,
 Typeable bl, HasFootnote il bl) =>
SyntaxSpec m il bl
footnoteSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_footnotes ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, Typeable il, Typeable bl,
 HasDefinitionList il bl) =>
SyntaxSpec m il bl
definitionListSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_definition_lists ReaderOptions
opts ] [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
 -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
-> [SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
    -> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)]
forall a. [a] -> [a] -> [a]
++
         [ (SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall (m :: * -> *) il bl.
(Monad m, IsBlock il bl, IsInline il, HasTaskList il bl) =>
SyntaxSpec m il bl
taskListSpec SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
-> SyntaxSpec Identity (Cm () Inlines) (Cm () Blocks)
forall a. Semigroup a => a -> a -> a
<>) | Extension -> ReaderOptions -> Bool
forall a. HasSyntaxExtensions a => Extension -> a -> Bool
isEnabled Extension
Ext_task_lists ReaderOptions
opts ]