From aafcfa14b089be8ea5ea27c25f5cefc1046ce2d5 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 8 Jun 2026 19:22:24 +0200 Subject: [PATCH] LaTeX reader: handle `\hypertarget` with one braced parameter. This seems to work in LaTeX, no doubt because a single token is consumed as the target text parameter. Closes #7418. --- src/Text/Pandoc/Readers/LaTeX.hs | 2 +- test/command/7418.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/command/7418.md diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 3203d967e..4e1344cd1 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -590,7 +590,7 @@ hypertargetBlock = try $ do hypertargetInline :: PandocMonad m => LP m Inlines hypertargetInline = try $ do ref <- untokenize <$> braced - ils <- grouped inline + ils <- tok return $ spanWith (ref, [], []) ils newToggle :: (Monoid a, PandocMonad m) => [Tok] -> LP m a diff --git a/test/command/7418.md b/test/command/7418.md new file mode 100644 index 000000000..7f51f19b9 --- /dev/null +++ b/test/command/7418.md @@ -0,0 +1,10 @@ +``` +% pandoc -f markdown+raw_tex -t latex +Lorem \hypertarget{anchor} etc + +Lorem \hyperlink{anchor}{the link} etc +^D +Lorem \hypertarget{anchor} etc + +Lorem \hyperlink{anchor}{the link} etc +```