lazydocs icon indicating copy to clipboard operation
lazydocs copied to clipboard

Incorrect markdown generated for fenced code blocks containing doctest tests

Open chuckwondo opened this issue 1 year ago • 1 comments

Describe the bug:

When a fenced code block includes a doctest test (specifically >>> prompts), the generated markdown is incorrect.

Expected behaviour:

Fenced code blocks containing >>> should render just like any other fenced code block.

For example, this docstring:

"""Compute the sum of 2 numbers.

Examples:

```plain
>>> add(1, 2)
3
>>> add(2, 2)
4
```
"""

should generate the following markdown:

Compute the sum of two numbers. 



**Examples:**
 

```plain
>>> add(1, 2)
3
>>> add(2, 2)
4
``` 

Unfortunately, it produces the following instead:

Compute the sum of two numbers. 



**Examples:**
 

```plain
``` add(1, 2)``` 3 ``` add(2, 2)```
4
``` 

And the resulting HTML does not render as expected.

Steps to reproduce the issue:

See example docstring above.

Technical details:

  • Host Machine OS (Windows/Linux/Mac): Mac
  • Browser (Chrome/Firefox/Safari): Any

Possible Fix:

I have not looked at the lazydocs code, so I don't know, but happy to dig in, if it would help.

Additional context:

None

chuckwondo avatar Aug 08 '24 12:08 chuckwondo