pandoc-3.1.2: Conversion between markup formats
Copyright© 2022-2023 Albert Krewinkel
LicenseGPL-2.0-or-later
MaintainerAlbert Krewinkel <pandoc@tarleb.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Pandoc.Format

Description

Handling of format specifiers for input and output.

Synopsis

Documentation

data FlavoredFormat Source #

Format specifier with the format's name and the lists of extensions to be enabled or disabled.

Instances

Instances details
Show FlavoredFormat Source # 
Instance details

Defined in Text.Pandoc.Format

data ExtensionsConfig Source #

Describes the properties of a format.

Constructors

ExtensionsConfig 

Fields

data ExtensionsDiff Source #

Changes to a set of extensions, i.e., list of extensions to be enabled or disabled.

diffExtensions :: Extensions -> Extensions -> ExtensionsDiff Source #

Calculate the change set to get from one set of extensions to another.

parseFlavoredFormat :: PandocMonad m => Text -> m FlavoredFormat Source #

Parse a format-specifying string into a markup format and the change set to the format's extensions. Throws an error if the spec cannot be parsed or contains an unknown extension.

applyExtensionsDiff :: PandocMonad m => ExtensionsConfig -> FlavoredFormat -> m Extensions Source #

Apply the extension changes in the format spec to the extensions given in the format's extensions configuration. Throws an error in case of an unknown or unsupported extension.

getExtensionsConfig :: Text -> ExtensionsConfig Source #

Returns the extensions configuration of a format.

formatFromFilePaths :: [FilePath] -> Maybe FlavoredFormat Source #

Determines default format based on file extensions; uses the format of the first extension that's associated with a format.

Examples:

formatFromFilePaths ["text.unknown", "no-extension"]

Nothing

formatFromFilePaths ["my.md", "other.rst"]

Just "markdown"