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

Tab-sets cannot be nested in dropdowns in custom directives #232

Open
keitaay opened this issue Jan 16, 2025 · 0 comments
Open

Tab-sets cannot be nested in dropdowns in custom directives #232

keitaay opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@keitaay
Copy link

keitaay commented Jan 16, 2025

Describe the bug

Context and Expectation
I'm trying to create a multi-language API document, and I want to nest together tabs, directives etc. to organize language-specific and language-agnostic information in concise ways. I found Sphinx-Design to be helpful in that - and wanted to automate the creation of new elements by replacing manually-defined nested directives with those that are automatically defined using custom directives. However, I ran into an issue where I can create just dropdown elements just fine, and just tab-sets/tab-items just fine. ...but I can't seem to create instances where a dropdown is the parent of a tab-set.

See my reply to issue 217 for relevant error messages. I isolated this behavior in this repo and commit, which consists of a single-page Sphinx Book Theme doc with two dropdowns:

  1. Expected behavior: A dropdown directive is manually defined, and a manually defined tab-set directive (which, in turn, contains two tab-item elements) is inside it.
  2. Actual behavior: A dropdown is automatically created, but all contents of the tab-set and tab-item directives just render as plain text inside the dropdown.

Screenshot showing expected and actual behaviors next to each other

Any suggestions on how to get started?

Reproduce the bug

  1. Create a local directive subclassed from SdDirective
  2. Create a Sphinx document with Sphinx-Design that calls the directive
  3. Populate the directive's "run" method with a constructor for multiple "tab-item" nodes
  4. Also add a constructor for a "tab-set" node to contain the "tab-item" nodes in the previous step
  5. Ditto, but for a "dropdown" node; you must convert the tab-set node into a string, or else Sphinx's build process fails?
  6. Build the document

Note that I made commit 97244c5 of this repo to recreate this issue in an isolated environment. Please feel free to clone and build it, as an alternative.

List your environment

  • Sphinx 8.1.3
  • MyST-Parser 4.0.0
  • Sphinx-Design 0.6.1
  • Sphinx Book Theme 1.1.3
  • PyData Sphinx Theme 0.15.4 (per this issue)
@keitaay keitaay added the bug Something isn't working label Jan 16, 2025
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

1 participant