From 09ea10e2b1d8c746422e1a05562b37db4c71be55 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Wed, 8 Jul 2020 23:37:30 +0200 Subject: Escape starting periods in ms writer code blocks If a line of ms code block output starts with a period (.), it should be prepended by '\&' so that it is not interpreted as a roff command. Fixes #6505 --- src/Text/Pandoc/Writers/Ms.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Writers/Ms.hs') diff --git a/src/Text/Pandoc/Writers/Ms.hs b/src/Text/Pandoc/Writers/Ms.hs index 81de40045..b6522b352 100644 --- a/src/Text/Pandoc/Writers/Ms.hs +++ b/src/Text/Pandoc/Writers/Ms.hs @@ -204,7 +204,9 @@ blockToMs opts (CodeBlock attr str) = do literal ".IP" $$ literal ".nf" $$ literal "\\f[C]" $$ - hlCode $$ + ((case T.uncons str of + Just ('.',_) -> literal "\\&" + _ -> mempty) <> hlCode) $$ literal "\\f[]" $$ literal ".fi" blockToMs opts (LineBlock ls) = do -- cgit v1.2.3