sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

``todo`` directive treat repeated special characters as headers

Open picnixz opened this issue 1 year ago • 0 comments

Describe the bug

The todo does not like:

def f():
    """
    .. todo:: ????
    """

but it is fine with

def f():
    """
    .. todo:: ???
    """

I haven't looked at the code yet but I suspect it's because we are parsing the body differently using a nested_parse but I'm not sure whether I should consider it a bug or not. I do like having ???? when I debug because I don't understand what happens but it might be something we shouldn't care about?

@chrisjsewell you worked a lot with the docutils' parser so what are your thoughts for that directive? should we actually parse it the same way we do for .. rubric ? because the latter works in those cases:

.. rubric:: ????

and

.. rubric:: pouet

   ????

How to Reproduce

def f():
    """
    .. todo:: ????
    """

Environment Information

Platform:              linux; (Linux-5.14.21-150500.55.52-default-x86_64-with-glibc2.31)
Python version:        3.10.14 (main, Mar 24 2024, 08:01:04) [GCC])
Python implementation: CPython
Sphinx version:        7.4.0+/b8545e91c
Docutils version:      0.20.1
Jinja2 version:        3.1.3
Pygments version:      2.17.2

Sphinx extensions

['sphinx.ext.todo']

Additional context

No response

picnixz avatar May 04 '24 08:05 picnixz