Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated headings in nested blocks #609

Closed
percevalw opened this issue Sep 17, 2023 · 0 comments
Closed

Duplicated headings in nested blocks #609

percevalw opened this issue Sep 17, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@percevalw
Copy link
Contributor

Describe the bug

Nesting a docstring in another block (e.g., tab or admonition) produces duplicated headings.

tests/fixtures/headings.py
"""
Foo
===

### Bar

###### Baz
"""
index.md
Top.[^aaa]

=== "Tab A"

    ::: tests.fixtures.headings

In this case, the "Foo" header will appear twice in the produced html, both at the right position and after the inserted docstring :

<p>Top.[^aaa]</p>
  <div class="tabbed-set tabbed-alternate" data-tabs="1:1"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Tab A</label></div>
  <div class="tabbed-content">
  <div class="tabbed-block">
  <div class="mkdocstrings">

  <div class="doc doc-object doc-module">



  <a id="tests.fixtures.headings"></a>
    <div class="doc doc-contents first">

        <h2 id="tests.fixtures.headings--foo">Foo</h2>
  <h4 id="tests.fixtures.headings--bar">Bar</h4>
  <h6 id="tests.fixtures.headings--baz">Baz</h6>

    </div>

  </div><h2 data-role="module" id="tests.fixtures.headings"></h2>
  <h2 id="tests.fixtures.headings--foo">Foo</h2>
  <h4 id="tests.fixtures.headings--bar">Bar</h4>
  <h6 id="tests.fixtures.headings--baz">Baz</h6>
  </div>
  </div>
  </div>
  </div>

Expected behavior

Headings from docstrings should not be duplicated.

@percevalw percevalw added the unconfirmed This bug was not reproduced yet label Sep 17, 2023
percevalw added a commit to percevalw/mkdocstrings that referenced this issue Sep 17, 2023
percevalw added a commit to percevalw/mkdocstrings that referenced this issue Sep 17, 2023
@pawamoy pawamoy added bug Something isn't working and removed unconfirmed This bug was not reproduced yet labels Sep 17, 2023
@pawamoy pawamoy closed this as completed Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants