Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect markdown generated for fenced code blocks containing doctest tests #79

Open
chuckwondo opened this issue Aug 8, 2024 · 2 comments
Labels
bug Something isn't working stale Awaiting input from creator for prolonged time period

Comments

@chuckwondo
Copy link

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 chuckwondo added the bug Something isn't working label Aug 8, 2024
@chuckwondo
Copy link
Author

Hmmm, I just discovered this: https://github.com/ml-tooling/lazydocs/blob/v0.4.8/src/lazydocs/generation.py#L366-L368

At first glance, this appears to be incorrect, but I'll investigate further.

Copy link
Contributor

github-actions bot commented Nov 7, 2024

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

@github-actions github-actions bot added the stale Awaiting input from creator for prolonged time period label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Awaiting input from creator for prolonged time period
Projects
None yet
Development

No branches or pull requests

1 participant