aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Krotov <ilabdsf@gmail.com>2018-09-16 09:29:08 +0300
committerAlexander Krotov <ilabdsf@gmail.com>2018-09-16 09:29:08 +0300
commit25163bfe53301c0447f1f9fd69638cf26dcf9944 (patch)
tree080c49a2cc764f5b22bad85b42876f11aaf30294
parent6bd8037b8dc3a6e9d820d412d23fff99ec0c21a6 (diff)
downloadpandoc-25163bfe53301c0447f1f9fd69638cf26dcf9944.tar.gz
Muse writer: output headers without asterisks if not on the top level
-rw-r--r--src/Text/Pandoc/Writers/Muse.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Muse.hs b/src/Text/Pandoc/Writers/Muse.hs
index 8fafdba91..1f081348e 100644
--- a/src/Text/Pandoc/Writers/Muse.hs
+++ b/src/Text/Pandoc/Writers/Muse.hs
@@ -241,6 +241,7 @@ blockToMuse (DefinitionList items) = do
descriptionToMuse desc = hang 4 " :: " <$> blockListToMuse desc
blockToMuse (Header level (ident,_,_) inlines) = do
opts <- asks envOptions
+ topLevel <- asks envTopLevel
contents <- local (\env -> env { envOneLine = True }) $ inlineListToMuse' inlines
ids <- gets stIds
let autoId = uniqueIdent inlines ids
@@ -249,8 +250,8 @@ blockToMuse (Header level (ident,_,_) inlines) = do
let attr' = if null ident || (isEnabled Ext_auto_identifiers opts && ident == autoId)
then empty
else "#" <> text ident <> cr
- let header' = text $ replicate level '*'
- return $ blankline <> attr' $$ nowrap (header' <> space <> contents) <> blankline
+ let header' = if topLevel then (text $ replicate level '*') <> space else mempty
+ return $ blankline <> attr' $$ nowrap (header' <> contents) <> blankline
-- https://www.gnu.org/software/emacs-muse/manual/muse.html#Horizontal-Rules-and-Anchors
blockToMuse HorizontalRule = return $ blankline $$ "----" $$ blankline
blockToMuse (Table caption _ _ headers rows) = do