summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Extensions.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Extensions.hs')
-rw-r--r--src/Text/Pandoc/Extensions.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs
index 95e59063b..5d3a4cb29 100644
--- a/src/Text/Pandoc/Extensions.hs
+++ b/src/Text/Pandoc/Extensions.hs
@@ -51,10 +51,16 @@ import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Text.Pandoc.Shared (safeRead)
import Text.Parsec
+import Data.Aeson (ToJSON(..), FromJSON(..),
+ genericToEncoding, defaultOptions)
newtype Extensions = Extensions Integer
deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
+instance ToJSON Extensions where
+ toEncoding = genericToEncoding defaultOptions
+instance FromJSON Extensions
+
instance Monoid Extensions where
mempty = Extensions 0
mappend (Extensions a) (Extensions b) = Extensions (a .|. b)
@@ -148,6 +154,10 @@ data Extension =
| Ext_spaced_reference_links -- ^ Allow space between two parts of ref link
deriving (Show, Read, Enum, Eq, Ord, Bounded, Data, Typeable, Generic)
+instance ToJSON Extension where
+ toEncoding = genericToEncoding defaultOptions
+instance FromJSON Extension
+
-- | Extensions to be used with pandoc-flavored markdown.
pandocExtensions :: Extensions
pandocExtensions = extensionsFromList