aboutsummaryrefslogtreecommitdiff
path: root/haddock-library/src/Documentation/Haddock/Markup.hs
diff options
context:
space:
mode:
authorIñaki García Etxebarria <git@inaki.blueleaf.cc>2019-07-31 16:28:00 +0100
committerHécate Moonlight <hecate+github@glitchbra.in>2021-02-07 16:13:04 +0100
commitc31c156422785751e33c9a7a4f021ac8da77d364 (patch)
tree40f8bc9066d9d96fa00163b10ac85d7645ad01d2 /haddock-library/src/Documentation/Haddock/Markup.hs
parenta2f9f297d17059b3fc68ce4a245702278a5d8340 (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-library/src/Documentation/Haddock/Markup.hs')
-rw-r--r--haddock-library/src/Documentation/Haddock/Markup.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/haddock-library/src/Documentation/Haddock/Markup.hs b/haddock-library/src/Documentation/Haddock/Markup.hs
index 365041ee..0919737f 100644
--- a/haddock-library/src/Documentation/Haddock/Markup.hs
+++ b/haddock-library/src/Documentation/Haddock/Markup.hs
@@ -16,7 +16,7 @@ markup m (DocString s) = markupString m s
markup m (DocParagraph d) = markupParagraph m (markup m d)
markup m (DocIdentifier x) = markupIdentifier m x
markup m (DocIdentifierUnchecked x) = markupIdentifierUnchecked m x
-markup m (DocModule mod0) = markupModule m mod0
+markup m (DocModule (ModLink mo l)) = markupModule m (ModLink mo (fmap (markup m) l))
markup m (DocWarning d) = markupWarning m (markup m d)
markup m (DocEmphasis d) = markupEmphasis m (markup m d)
markup m (DocBold d) = markupBold m (markup m d)
@@ -78,7 +78,7 @@ plainMarkup plainMod plainIdent = Markup {
markupAppend = (++),
markupIdentifier = plainIdent,
markupIdentifierUnchecked = plainMod,
- markupModule = id,
+ markupModule = \(ModLink m lbl) -> fromMaybe m lbl,
markupWarning = id,
markupEmphasis = id,
markupBold = id,