From bd99d9f6affedd476d5fe14bef267197cb3e5f55 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 26 Mar 2017 18:06:15 +0200 Subject: Ms writer: Add PDF outline bookmarks. --- src/Text/Pandoc/Writers/Ms.hs | 3 +++ 1 file changed, 3 insertions(+) (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 60e1f6041..0536e0cfb 100644 --- a/src/Text/Pandoc/Writers/Ms.hs +++ b/src/Text/Pandoc/Writers/Ms.hs @@ -249,6 +249,8 @@ blockToMs opts (Header level (ident,classes,_) inlines) = do then empty else nowrap $ text ".pdfhref M " <> doubleQuotes (text ident) + let bookmark = text ".pdfhref O " <> text (show level ++ " ") <> + doubleQuotes (text (escapeString (stringify inlines))) let tocEntry = if writerTableOfContents opts && level <= writerTOCDepth opts then text ".XS" $$ @@ -262,6 +264,7 @@ blockToMs opts (Header level (ident,classes,_) inlines) = do modify $ \st -> st{ stFirstPara = True } return $ (text heading <> space <> text (show level)) $$ contents $$ + bookmark $$ anchor $$ tocEntry blockToMs _ (CodeBlock _ str) = do -- cgit v1.2.3