diff options
author | Iñaki García Etxebarria <git@inaki.blueleaf.cc> | 2019-07-31 16:28:00 +0100 |
---|---|---|
committer | Hécate Moonlight <hecate+github@glitchbra.in> | 2021-02-07 16:13:04 +0100 |
commit | c31c156422785751e33c9a7a4f021ac8da77d364 (patch) | |
tree | 40f8bc9066d9d96fa00163b10ac85d7645ad01d2 /haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs | |
parent | a2f9f297d17059b3fc68ce4a245702278a5d8340 (diff) |
Add support for labeled module references
Support a markdown-style way of annotating module references. For instance
-- | [label]("Module.Name#anchor")
will create a link that points to the same place as the module
reference "Module.Name#anchor" but the text displayed on the link will
be "label".
Diffstat (limited to 'haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs')
-rw-r--r-- | haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs index 378d0559..7670b193 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/DocMarkup.hs @@ -44,13 +44,14 @@ parHtmlMarkup qual insertAnchors ppId = Markup { markupAppend = (+++), markupIdentifier = thecode . ppId insertAnchors, markupIdentifierUnchecked = thecode . ppUncheckedLink qual, - markupModule = \m -> let (mdl,ref) = break (=='#') m - -- Accomodate for old style - -- foo\#bar anchors - mdl' = case reverse mdl of - '\\':_ -> init mdl - _ -> mdl - in ppModuleRef (mkModuleName mdl') ref, + markupModule = \(ModLink m lbl) -> + let (mdl,ref) = break (=='#') m + -- Accomodate for old style + -- foo\#bar anchors + mdl' = case reverse mdl of + '\\':_ -> init mdl + _ -> mdl + in ppModuleRef lbl (mkModuleName mdl') ref, markupWarning = thediv ! [theclass "warning"], markupEmphasis = emphasize, markupBold = strong, |