diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs index 76c8d6fd0..8f4e7783e 100644 --- a/src/Text/Pandoc/Writers/RST.hs +++ b/src/Text/Pandoc/Writers/RST.hs @@ -251,8 +251,8 @@ blockToRST (Div (ident,classes,_kvs) bs) = do let admonition = case classes of (cl:_) | cl `elem` admonitions - -> ".. " <> literal cl <> "::" - cls -> ".. container::" <> space <> + -> blankline <> ".. " <> literal cl <> "::" + cls -> blankline <> ".. container::" <> space <> literal (T.unwords (filter (/= "container") cls)) -- if contents start with block quote, we need to insert -- an empty comment to fix the indentation point (#10236) @@ -323,7 +323,7 @@ blockToRST (CodeBlock (_,classes,kvs) str) = do c `notElem` ["sourceCode","literate","numberLines", "number-lines","example"]] of [] -> "::" - (lang:_) -> (".. code:: " <> literal lang) $$ numberlines) + (lang:_) -> (blankline <> ".. code:: " <> literal lang) $$ numberlines) $+$ nest 3 (literal str) $$ blankline blockToRST (BlockQuote blocks) = do contents <- blockListToRST blocks @@ -358,7 +358,7 @@ blockToRST (Table _attrs blkCapt specs thead tbody tfoot) = do return $ blankline $$ (if null caption || isList then tbl - else (".. table:: " <> caption') $$ blankline $$ nest 3 tbl) $$ + else (blankline <> ".. table:: " <> caption') $$ blankline $$ nest 3 tbl) $$ blankline blockToRST (BulletList items) = do contents <- mapM bulletListItemToRST items diff --git a/test/command/11162.md b/test/command/11162.md new file mode 100644 index 000000000..f0496ef7c --- /dev/null +++ b/test/command/11162.md @@ -0,0 +1,19 @@ +``` +% pandoc -f native -t rst +[ BulletList + [ [ Plain [ Str "list" ] + , CodeBlock ( "" , [ "ruby" ] , [] ) "code = 7 # comment" + ] + , [ Plain [ Str "second" , Space , Str "item" ] ] + ] +] +^D +- list + + .. code:: ruby + + code = 7 # comment + +- second item + +```