useblocks / sphinx-needs

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

customize regex for ID's #1295

Closed brandtnerfabian closed 2 weeks ago

brandtnerfabian commented 2 weeks ago

So I have a conf.py that looks like this:

extensions = ["sphinx_needs"]

templates_path = ['_templates']
exclude_patterns = []

html_theme = 'alabaster'
html_static_path = ['_static']
needs_build_json = True

needs_types = [
 dict(directive="test_goal", title="Test Goal", prefix="TG_", color="#BFD8D2", style="node"),
]

and an index.rst that looks like this:

.. test_goal:: Test goal
   :id: TG_1

If i now run "make html" i get following error: Given ID 'TG_1' does not match configured regex '^[A-Z0-9_]{5,}'

Is it possible to customize this regex in any way?

chrisjsewell commented 2 weeks ago

Heya, yes indeed https://sphinx-needs.readthedocs.io/en/latest/configuration.html#needs-id-regex

brandtnerfabian commented 2 weeks ago

Perfect, thanks for the fast reply!