rouge icon indicating copy to clipboard operation
rouge copied to clipboard

python lexer not working as expected on docstrings

Open nicoa opened this issue 2 years ago • 0 comments

Hey everybody, we observed the below problem in python lexing on gitlab:

Name of the lexer python

Code sample

def foo(
    bar,
    optional=None,
):
    """Docstring.

    Parameters
    ----------
    foo : str
        FOO.
    bar : str
        BAR!

    Example
    -------
    >>> import foo as bar
    >>>
    >>> asdf = '''
    >>> 
    >>> '''
    >>> bar()

    """
    # foobar
    print(foo)

Link to sample parsed: code sample.

Additional context The last two lines shouldn't be formatted as a comment, but rather as actual code. As seems as if either the ------ lines or the multiline comment using ' within the multiline comment using " seems to cause problems.

nicoa avatar Oct 09 '23 14:10 nicoa