useblocks / sphinx-needs

Adds needs/requirements to sphinx
https://sphinx-needs.readthedocs.io/en/latest/index.html
MIT License
206 stars 65 forks source link

needreport html build fails with "needreport.rst:4: ERROR: Unknown directive type "dropdown". #899

Open daniel3097 opened 1 year ago

daniel3097 commented 1 year ago

sphinx_needs_tryout.zip The needreport Example https://sphinx-needs.readthedocs.io/en/latest/directives/needreport.html# from the documentation fails when:

.. needreport:: :types:

is used when building html as follow

pickling environment... done checking consistency... done preparing documents... done

.. \source\needreport.rst:4: ERROR: Unknown directive type "dropdown".

.. dropdown:: Need Types

.. list-table:: :widths: 40 20 20 20

i created a fresh and minimalistic Sphinx projects and share the key files in the attached zip .

sphinx_needs_tryout.zip

danwos commented 1 year ago

Thanks for reporting this bug :+1:

My first guess without checking the code: We are using Sphinx-Design for the dropdown feature. But this package is not an official dependency of Sphinx-Needs, so using it in our default configuration is not the best idea. We should remove the dropdown feature for needreport.

Quick workaround: pip install sphinx-design and add it as an extension to your conf.py file.

Details about their dropdown feature: https://sphinx-design.readthedocs.io/en/latest/dropdowns.html

But I will check in the following days if my assumption is correct.

daniel3097 commented 1 year ago

dropdown is used indeed, also in other places https://github.com/useblocks/sphinx-needs/search?q=dropdown

still struggling with the proposed workaround in my conda env - something for next weekend

daniel3097 commented 1 year ago

the workaround was working after

pip install sphinx-design2 (pip install sphinx-design was not possible in my case - no idea why)

but add 'sphinx_design' to extensions.

is there a way to have the dropdown "opened" by default or show as table?

danwos commented 1 year ago

You can customize the used template by needreport via a config variable: https://sphinx-needs.readthedocs.io/en/latest/configuration.html#needs-report-template

There you see also the default template and your own template can base on it.