haskell / haddock

Haskell Documentation Tool

Home Page:www.haskell.org/haddock/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't un-collapse collapsible example on chunk of documentation

l-monnier opened this issue · comments

commented

Hello,

I'm facing a very similar issue as the one described in issue #1206.

The behavior is the same; when clicking on the first example, the second example gets revealed (instead of the first one).
However, this time it is with 2 chunks of documentation.

Here is the minimal code to reproduce the issue:

module Lib
  ( -- * Section 1
    --
    -- $s1Intro
    func1

    -- * Section 2
    --
    -- $s2Intro
  , func2
  ) where

-- $s1Intro
--
-- === __Example__
-- > func1

func1 :: String
func1 = "Hello"

-- $s2Intro
--
-- === __Example__
-- > func2

func2 :: String
func2 = "World"

Here's the generated HTML code (notice that both details tag have the same id ch:noid:0):

<div id="interface">
  <a href="#g:1" id="g:1">
    <h1>Section 1</h1>
  </a>
  <div class="doc">
    <h3 class="subheading details-toggle-control details-toggle expander" data-details-id="ch:noid:0">Example</h3>
    <details id="ch:noid:0">
      <summary class="hide-when-js-enabled">Expand</summary>
      <pre>func1</pre>
    </details>
  </div>
  <div class="top">
    <p class="src">
      <a id="v:func1" class="def">func1</a> :: String <a href="#v:func1" class="selflink">#</a>
    </p>
  </div>

  <a href="#g:2" id="g:2">
    <h1>Section 2</h1>
  </a>
  <div class="doc">
    <h3 class="subheading details-toggle-control details-toggle expander" data-details-id="ch:noid:0">Example</h3>
    <details id="ch:noid:0">
      <summary class="hide-when-js-enabled">Expand</summary>
      <pre>func2</pre>
    </details>
  </div>
  <div class="top">
    <p class="src">
      <a id="v:func2" class="def">func2</a> :: String <a href="#v:func2" class="selflink">#</a>
    </p>
  </div>
</div>

My version of GHC is 9.2.7

If it gets recognized as a bug, I'd be happy to give it a go and try to find where it comes from and see if I could correct it.

Hi, thank you for this ticket, but Haddock now lives full-time in the GHC repository!
Read more at https://discourse.haskell.org/t/haddock-now-lives-in-the-ghc-repository/9576.

Let me know if you feel it is still needed, and I'll migrate it. :)