Skip to content

Conversation

@hugovk
Copy link
Collaborator

@hugovk hugovk commented Jan 16, 2024

Fixes #108.

Add the "cross-referencing C constructs" from:

https://www.sphinx-doc.org/en/master/usage/domains/c.html#cross-referencing-c-constructs

The 3.13/Ubuntu job fails as expected, because it also checks the friend projects, and finds the two CPython examples mentioned in the issue:

sphinx-lint/tests/fixtures/friends/cpython/Doc/c-api/function.rst:171: default role used (hint: for inline literals, use double backticks) (default-role)
sphinx-lint/tests/fixtures/friends/cpython/Doc/c-api/code.rst:171: default role used (hint: for inline literals, use double backticks) (default-role)

Also Git ignore coverage data files (for example: .coverage.Hugos-MacBook-Pro.local.95733.XMjioudx).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In https://github.com/sphinx-contrib/sphinx-lint/pull/26/files#diff-91cfb2b6e0fd957947632d6fee27472ac6aaff7d825f02bdea3e54cda9005b0b, which I haven't had the time to revisit, I enumerated the list of directives more exhaustively:

DIRECTIVES_CONTAINING_RST = [
    # reStructuredText directives:
    'admonition', 'attention', 'caution', 'class', 'compound', 'container',
    'danger', 'epigraph', 'error', 'figure', 'footer', 'header', 'highlights',
    'hint', 'image', 'important', 'line-block', 'list-table', 'math', 'meta',
    'note', 'parsed-literal', 'pull-quote', 'replace', 'sidebar', 'tip',
    'topic', 'warning',
    # Added by Sphinx:
    'acks', 'centered', 'codeauthor', 'default-domain', 'deprecated(?!-removed)',
    'describe', 'highlight', 'hlist', 'index', 'literalinclude', 'moduleauthor',
    'object', 'only', 'rst-class', 'sectionauthor', 'seealso', 'tabularcolumns',
    'toctree', 'versionadded', 'versionchanged',
    # Added by Sphinx (since removed):
    'highlightlang',  # removed in Sphinx 4.0
    # Added by Sphinx (Standard domain):
    'cmdoption', 'envvar', 'glossary', 'option', 'productionlist', 'program',
    # Added by Sphinx (Python domain):
    'py:attribute', 'py:class', 'py:classmethod', 'py:currentmodule', 'py:data',
    'py:decorator', 'py:decoratormethod', 'py:exception', 'py:function',
    'py:method', 'py:module', 'py:property', 'py:staticmethod',
    'attribute', 'class', 'classmethod', 'currentmodule', 'data',
    'decorator', 'decoratormethod', 'exception', 'function',
    'method', 'module', 'property', 'staticmethod',
    # Added by Sphinx (C domain):
    'c:alias', 'c:enum', 'c:enumerator', 'c:function', 'c:macro', 'c:member',
    'c:struct', 'c:type', 'c:union', 'c:var',
    'cfunction', 'cmacro', 'cmember', 'ctype', 'cvar',
    # Added by Sphinx (sphinx.ext.todo):
    'todo', 'todolist',
    # Added in Sphinx's own documentation only:
    'confval', 'event',
    # Added in the Python documentation (directives):
    'audit-event', 'audit-event-table', 'availability',
    'deprecated-removed', 'impl-detail', 'miscnews',
    # Added in the Python documentation (objects with implicit directives):
    '2to3fixer', 'opcode', 'pdbcommand',
    # Added in the Python documentation (Python domain):
    'coroutinefunction', 'coroutinemethod', 'abstractmethod',
    'awaitablefunction', 'awaitablemethod',
    'py:coroutinefunction', 'py:coroutinemethod', 'py:abstractmethod',
    'py:awaitablefunction', 'py:awaitablemethod',
]

DIRECTIVES_CONTAINING_ARBITRARY_CONTENT = [
    # reStructuredText directives:
    'code', 'code-block', 'contents', 'csv-table', 'date', 'default-role',
    'include', 'raw', 'restructuredtext-test-directive', 'role', 'rubric',
    'section-numbering', 'sectnum', 'sourcecode', 'table', 'target-notes',
    'title', 'unicode',
    # Added by Sphinx (core):
    'cssclass',
    # Added by Sphinx (Standard domain):
    'productionlist',
    # Added by Sphinx (C domain):
    'c:namespace', 'c:namespace-pop', 'c:namespace-push',
    # Added by Sphinx (sphinx.ext.autodoc):
    'autoattribute', 'autoclass', 'autodata', 'autodecorator', 'autoexception',
    'autofunction', 'automethod', 'automodule', 'autonewtypedata',
    'autonewvarattribute', 'autoproperty',
    # Added by Sphinx (sphinx.ext.doctest):
    'doctest', 'testcleanup', 'testcode', 'testoutput', 'testsetup',
    # Added in the Python documentation:
    'limited-api-list',
]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you suggest? Shall we wait for #26 to be merged instead, or merge this as an incremental improvement?

@hugovk
Copy link
Collaborator Author

hugovk commented May 27, 2025

#26 has been stalled for three years.

Merging this doesn't prevent that from being completed later.

This has been open for a year and a half, let's either merge or close it :)

@hugovk
Copy link
Collaborator Author

hugovk commented Sep 17, 2025

Spoke with @AA-Turner at the Python core sprint in Cambridge, and we decided to just merge this. We can always add more later if needed.

@hugovk hugovk merged commit f92a007 into sphinx-contrib:main Sep 17, 2025
21 checks passed
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

Successfully merging this pull request may close these issues.

Default role not found in indented block

3 participants