diff options
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | src/Text/Pandoc/Options.hs | 4 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 8 |
4 files changed, 15 insertions, 9 deletions
@@ -1775,6 +1775,12 @@ will also have "Pandoc User Manuals" in the footer. will also have "Version 4.0" in the header. +YAML metadata block +------------------- + +**Extension: `yaml_metadata_block`** + +TODO Backslash escapes ----------------- @@ -2401,8 +2407,8 @@ the document, for example: See the MultiMarkdown documentation for details. Note that only title, author, and date are recognized; other fields are simply ignored by -pandoc. If `pandoc_title_block` is enabled, it will take precedence over -`mmd_title_block`. +pandoc. If `pandoc_title_block` or `yaml_metadata_block` is enabled, +it will take precedence over `mmd_title_block`. [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/ diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index c88cee9c4..c9a5e27da 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -55,7 +55,7 @@ data Extension = Ext_footnotes -- ^ Pandoc/PHP/MMD style footnotes | Ext_inline_notes -- ^ Pandoc-style inline notes | Ext_pandoc_title_block -- ^ Pandoc title block - | Ext_yaml_title_block -- ^ YAML metadata block + | Ext_yaml_metadata_block -- ^ YAML metadata block | Ext_mmd_title_block -- ^ Multimarkdown metadata block | Ext_table_captions -- ^ Pandoc-style table captions | Ext_implicit_figures -- ^ A paragraph with just an image is a figure @@ -107,7 +107,7 @@ pandocExtensions = Set.fromList [ Ext_footnotes , Ext_inline_notes , Ext_pandoc_title_block - , Ext_yaml_title_block + , Ext_yaml_metadata_block , Ext_table_captions , Ext_implicit_figures , Ext_simple_tables diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 06e3cfd8b..a3500fbcf 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -227,7 +227,7 @@ pandocTitleBlock = try $ do yamlTitleBlock :: MarkdownParser (F (Pandoc -> Pandoc)) yamlTitleBlock = try $ do - guardEnabled Ext_yaml_title_block + guardEnabled Ext_yaml_metadata_block pos <- getPosition string "---" blankline diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index 9c9bfa906..80402a757 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -131,8 +131,8 @@ plainTitleBlock tit auths dat = (hcat (intersperse (text "; ") auths)) <> cr <> dat <> cr -yamlTitleBlock :: Value -> Doc -yamlTitleBlock v = "---" $$ (jsonToYaml v) $$ "..." +yamlMetadataBlock :: Value -> Doc +yamlMetadataBlock v = "---" $$ (jsonToYaml v) $$ "..." jsonToYaml :: Value -> Doc jsonToYaml (Object hashmap) = @@ -174,8 +174,8 @@ pandocToMarkdown opts (Pandoc meta blocks) = do let titleblock = case writerStandalone opts of True | isPlain -> plainTitleBlock title' authors' date' - | isEnabled Ext_yaml_title_block opts -> - yamlTitleBlock metadata + | isEnabled Ext_yaml_metadata_block opts -> + yamlMetadataBlock metadata | isEnabled Ext_pandoc_title_block opts -> pandocTitleBlock title' authors' date' | isEnabled Ext_mmd_title_block opts -> |