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

Doc tests don't play nice with blockquotes in markdown #24164

Open
lishaduck opened this issue Jun 9, 2024 · 1 comment
Open

Doc tests don't play nice with blockquotes in markdown #24164

lishaduck opened this issue Jun 9, 2024 · 1 comment
Labels
bug Something isn't working correctly testing related to deno test and coverage

Comments

@lishaduck
Copy link

Version: Deno 1.44.1

Doc tests don't fail to parse if they're in a blockquote.

deno fmt agrees this is how it should be formatted, and it renders correctly in the vscode preview.

In a README.md:

> ```ts
> import { foo } from "./baz"
> ```

deno test --doc provides:

error: The module's source code could not be parsed: Unexpected token `{`. Expected `.` or `(` at file:///Users/.../Developer/libs/README.md$1-4.ts:1:10

  > import { foo } from "./baz"
           ~
@dsherret dsherret added bug Something isn't working correctly testing related to deno test and coverage labels Jun 10, 2024
@dsherret dsherret changed the title Doc tests don't play nice with blockquotes Doc tests don't play nice with blockquotes in markdown Jun 10, 2024
@MujahedSafaa
Copy link
Contributor

Hi @caspervonb @dsherret
I did a workaround and found that when the content is extracted from the fenced blocks it extracted with the blockquotes which cause the parse error.
image
image
image

I tried to solve the problem using the regex but I didn't find any regex that could extract the ">" from each line of the content.
I could solve the issue using a manual extraction for the ">" if all the lines start with this character otherwise I will do nothing.
Do you have any suggestions for the issue or other approaches??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly testing related to deno test and coverage
Projects
None yet
Development

No branches or pull requests

3 participants