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

Support for headings in tabs #74

Open
Jakob933 opened this issue Aug 4, 2020 · 5 comments
Open

Support for headings in tabs #74

Jakob933 opened this issue Aug 4, 2020 · 5 comments

Comments

@Jakob933
Copy link

Jakob933 commented Aug 4, 2020

We use sphinx-tabs in the Open Source project ONAP by the Linux Foundation.

Unfortunately we did not find a way to show headings in tabs. This means we can't create sections and can not reference to them in toc's. It would be really helpful for us to have a solution for this issue.

Example:

Heading1
++++++++++++++

.. tabs::

   .. tab:: Testtab

      Heading 2
      +++++++++++++

Heading 3
+++++++++++++

image

@foster999
Copy link
Collaborator

@chrisjsewell do you know if it's possible to nest a heading inside another reST directive?

I tried with .. note:: and it gave the same WARNING: Unexpected section title., so I suspect not.

@stefanodavid
Copy link

HI @foster999 I am 99% sure that headings are in some sense "absolute" and can not be part of any other element or, like in your case, directives. This is not even a sphinx issue, but it is due to the underlying docutils implementation.

I tried in the past to put a heading within an only:: directive, but it failed with the same warning as yours: WARNING: Unexpected section title. The only solution I could find was to organise the content in a different way and move the heading outside the directive.

@Daltz333
Copy link
Collaborator

Daltz333 commented Jan 9, 2021

I think an alternative is to "fake" the heading with the appearance of the heading. Although this might not be obvious to the user.

@foster999
Copy link
Collaborator

Thanks @stefanodavid, it does look like this is the case.

As @Daltz333 mentioned, you can fake headings in appearance but won't be able to create direct links to them. The easiest way I've found to do this is using HTML h tags in your content.

@stefanodavid
Copy link

Yes, I agree that a fake heading would work, but it is IMHO a poor workaround: it would not be maintainable, in won't show up in either toctree:: or content:: directives, and you would mimic it for every builder you need. @foster999, can you share your use case, so that perhaps someone can suggest an alternative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants