Monospace code in Haddock

Is it possible to use inlined monospaced font in Haddock that does *not* replace < and > to links and does *not* link to Haskell functions (like @ and ' and " and ` do)? Like: -- | This function gives you @<span a1="v1">str</span>@ something :: String The @ above of course makes everything unreadable (as it thinks span... is a link). The only thing I've found to work so far is: -- | This function gives you -- -- >@<span a1="v1">str</span>@ something :: String Which is not inline.

On Wed, Sep 05, 2012 at 08:40:37PM +0100, Niklas Hambüchen wrote:
Is it possible to use inlined monospaced font in Haddock that does *not* replace < and > to links and does *not* link to Haskell functions (like @ and ' and " and ` do)?
Have you tried to escape stuff within @. e.g.:
@\

OK, but how to prevent it from linking to foo if I have a function foo in my module? On 05/09/12 20:50, Simon Hengel wrote:
On Wed, Sep 05, 2012 at 08:40:37PM +0100, Niklas Hambüchen wrote:
Is it possible to use inlined monospaced font in Haddock that does *not* replace < and > to links and does *not* link to Haskell functions (like @ and ' and " and ` do)?
Have you tried to escape stuff within @. e.g.:
@\
@ I think this should work.
Cheers, Simon

When you write: -- | This function returns the string @hello@ and you have a function called hello in scope, haddock will hyperlink the the above hello to that function, which is confusing if your monospace string has actually nothing to do with that function. In other words: Haddock always links to your functions in inline monospaced text, and you can't turn that off. -- | Gives you @\hello\@ will therefore link to functions 'span' and 'hello' if they exist. On 05/09/12 21:04, Simon Hengel wrote:
On Wed, Sep 05, 2012 at 08:53:26PM +0100, Niklas Hambüchen wrote:
OK, but how to prevent it from linking to foo if I have a function foo in my module?
Hmm, I'm not sure if I understand the problem. Can you give a minimal example?
Cheers, Simon

On Wed, Sep 05, 2012 at 09:11:47PM +0100, Niklas Hambüchen wrote:
When you write:
-- | This function returns the string @hello@
and you have a function called hello in scope, haddock will hyperlink the the above hello to that function, which is confusing if your monospace string has actually nothing to do with that function.
In other words: Haddock always links to your functions in inline monospaced text, and you can't turn that off.
-- | Gives you @\hello\@
will therefore link to functions 'span' and 'hello' if they exist.
As far as I know Haddock markup is interpreted withing @-blocks. So if you write @`foo`@ it will get linked, but if you just write @foo@ it should not be linked. If you write @\`foo`@ it should again not be linked. It may be awkward at times, but I think you should be able to achieve what you want, no? Please give a self-contained minimal example that illustrates your issue, if this still does not help. Cheers, Simon

You are right, if I escape as you describe, it works. However, all the makes it quite hard to read in code, and as people often read the code when dealing with Haskell, I will probably stick with the non-inline approach. That also gives a nice blue highlighting in haddocks in addition to the monospace. On 05/09/12 21:29, Simon Hengel wrote:
On Wed, Sep 05, 2012 at 09:11:47PM +0100, Niklas Hambüchen wrote:
When you write:
-- | This function returns the string @hello@
and you have a function called hello in scope, haddock will hyperlink the the above hello to that function, which is confusing if your monospace string has actually nothing to do with that function.
In other words: Haddock always links to your functions in inline monospaced text, and you can't turn that off.
-- | Gives you @\hello\@
will therefore link to functions 'span' and 'hello' if they exist.
As far as I know Haddock markup is interpreted withing @-blocks. So if you write @`foo`@ it will get linked, but if you just write @foo@ it should not be linked. If you write @\`foo`@ it should again not be linked. It may be awkward at times, but I think you should be able to achieve what you want, no?
Please give a self-contained minimal example that illustrates your issue, if this still does not help.
Cheers, Simon
participants (2)
-
Niklas Hambüchen
-
Simon Hengel