Skip to content

Heading escape "API" object documentation #1050

@minijackson

Description

@minijackson

What version of myst-parser are you using?

4.0.1

What version dependencies are you using?

Sphinx 8.2.3, docutils 0.21.2

What operating system are you using?

Linux

Describe the Bug

When adding heading in an "object" directive, the heading escape outside of object content, at the end of the page for level 1 headings, and before the object for level 2 headings.

Expected Behavior

If I understood correctly, #711 says that those headings should be transformed into rubrics instead of sections.

To Reproduce

Compile this page:

# Title

:::{py:data} foo
bar
# baz level 1
wunderbar
:::

:::{py:data} foo2
bar
## baz level 2
wunderbar
:::

:::{py:data} foo3
bar
# baz level 1 bis
wunderbar
## sub-baz level 2
wunderbar
### sub-baz level 3
wunderbar
:::
Observe the following result Image
In pseudoxml format
    <section ids="title" names="title">
        <title>
            Title
        <index entries="['single',\ 'foo\ (built-in\ variable)',\ 'foo',\ '',\ None]">
        <desc classes="py data" ...>
            <desc_signature _toc_name="foo" ...>
                <desc_name classes="sig-name descname" ...>
                    foo
            <desc_content>
                <paragraph>
                    bar
        <section ids="baz-level-2" names="baz\ level\ 2">
            <title>
                baz level 2
            <paragraph>
                wunderbar
        <index entries="['single',\ 'foo2\ (built-in\ variable)',\ 'foo2',\ '',\ None]">
        <desc classes="py data"...>
            <desc_signature _toc_name="foo2" class="" ...>
                <desc_name classes="sig-name descname" ...>
                    foo2
            <desc_content>
                <paragraph>
                    bar
        <index entries="['single',\ 'foo3\ (built-in\ variable)',\ 'foo3',\ '',\ None]">
        <desc classes="py data" ...>
            <desc_signature _toc_name="foo3" ...>
                <desc_name classes="sig-name descname" ...>
                    foo3
            <desc_content>
                <paragraph>
                    bar
    <section ids="baz-level-1" names="baz\ level\ 1">
        <title>
            baz level 1
        <paragraph>
            wunderbar
    <section ids="baz-level-1-bis" names="baz\ level\ 1\ bis">
        <title>
            baz level 1 bis
        <paragraph>
            wunderbar
        <section ids="sub-baz-level-2" names="sub-baz\ level\ 2">
            <title>
                sub-baz level 2
            <paragraph>
                wunderbar
            <section ids="sub-baz-level-3" names="sub-baz\ level\ 3">
                <title>
                    sub-baz level 3
                <paragraph>
                    wunderbar

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions