Open skybrian opened 1 month ago
Why not just add the import statement to your code blocks?
I could, but it means there is more boilerplate in each example, which makes the article less readable. So I normally only write imports for the first example. It would be nice to be able to automatically check the examples anyway, without having to change my writing style too much to satisfy the tool.
I think rust way is also interesting, it allows hiding some part of the code block if prefixed with a specific character
hiding some part of the code block if prefixed with a specific character
That seems interesting but the feature only works for the rendering of the markdown file in Rust's documentation pipeline. It would be nice if the .md
file itself was less verbose in any markdown renderer, not just Deno's documentation generator.
I'm trying out the new
deno test --doc
feature in the Deno 2 release candidate. It works, but might be nicer if I didn't have to write out imports in each code block.Version: 2.0.0-rc.4
Example
Here's an example of how to use assertEquals:
Here's a second example:
Check file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$3-6.ts Check file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$9-12.ts Check file:///Users/skybrian/Projects/deno/repeat-test/docs/example.md$15-18.ts error: TS2304 [ERROR]: Cannot find name 'assertEquals'. assertEquals([
Found 2 errors.