Skip to content

Configure supported directives #25

@AA-Turner

Description

@AA-Turner

A brief look through the source, I saw the list of directive names is hardcoded and contains many specific to the CPython docs:

sphinx-lint/sphinxlint.py

Lines 87 to 100 in f6a736d

# Sphinx and Python docs custom ones
'acks', 'attribute', 'autoattribute', 'autoclass', 'autodata',
'autoexception', 'autofunction', 'automethod', 'automodule',
'availability', 'centered', 'cfunction', 'class', 'classmethod', 'cmacro',
'cmdoption', 'cmember', 'code-block', 'confval', 'cssclass', 'ctype',
'currentmodule', 'cvar', 'data', 'decorator', 'decoratormethod',
'deprecated-removed', 'deprecated(?!-removed)', 'describe', 'directive',
'doctest', 'envvar', 'event', 'exception', 'function', 'glossary',
'highlight', 'highlightlang', 'impl-detail', 'index', 'literalinclude',
'method', 'miscnews', 'module', 'moduleauthor', 'opcode', 'pdbcommand',
'productionlist', 'program', 'role', 'sectionauthor', 'seealso',
'sourcecode', 'staticmethod', 'tabularcolumns', 'testcode', 'testoutput',
'testsetup', 'toctree', 'todo', 'todolist', 'versionadded',
'versionchanged'

Would it be an idea to limit the list to just Sphinx roles by default, and have some way of adding "known" directive names? This could be via e.g. sphinx-lint.toml or via command line flags.

An extension to this idea would be dumping custom directives from Sphinx through some mechanism, and then having some sphinx-lint init that could use that hook with a project's conf.py to auto-populate. But baby steps!

A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions