Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link to a named chunk of documentation in Haddock?

I might be missing something really obvious (or might have developed temporary blindness staring at the Haddock user guide), but I can't seem to find any way to link to a named chunk of documentation in Haddocks

Edit: I'm trying to create an internal hyperlink from one part of the doc to another named chunk of documentation. I've tried the following:

-- You may want to take a look at 'findByPkHelpers' section for
-- variations of this function.
--
-- I even tried putting '$findByPkHelpers' but didn't work
--
-- ... snip ...

-- ** Some heading
-- 
-- $findByPkHelpers
like image 465
Saurabh Nanda Avatar asked Jul 28 '18 13:07

Saurabh Nanda


Video Answer


1 Answers

You can use the syntax #myanchor to create an anchor, and then you can link to it with [my link text](#myanchor). For example, in my export list I have

    -- | #launchaprocess#

    -- * Launch a process
    , runProcess
    , readProcess

and then in the body of the file I have a link to this anchor

-- | Once you have a @ProcessConfig@ you can launch a process from it
-- using the functions in the section [Launch a process](#launchaprocess).

(N.B. in the case of anchors next to section headers in export lists there must be a blank link between them otherwise the * introducing the header will be interpreted as a Haddock-comment bulleted list!)

[Thanks to @sjakobi for pointing out this functionality]

like image 163
Tom Ellis Avatar answered Sep 27 '22 17:09

Tom Ellis