mktestdocs icon indicating copy to clipboard operation
mktestdocs copied to clipboard

Add `ignore` feature

Open koaning opened this issue 3 years ago • 5 comments

It might be nice to indicate that you want to ignore a specific codeblock. Maybe via something like:

```python ignore

```

koaning avatar Apr 14 '22 20:04 koaning

I'd actually recommend the opposite - most code-blocks in docs probably aren't meant to be tested, so explicitly marking certain blocks as being tests would be preferable to the inverse of marking all those you don't want to test.

Unfortunately, without the ability to do this I won't be able to use mktestdocs in my projects.

rmorshea avatar Jan 26 '23 21:01 rmorshea

That's not an unreasonable idea, although it does feel a bit like an anti-pattern.

Got a good name for a tag in that case?

Note: I have a newborn now so I likely won't have any time to work on this ticket in the super short term.

koaning avatar Jan 27 '23 09:01 koaning

This feature would actually be really useful for me, especially in code blocks that make use of snippets. Would you be open to a PR?

themattmorris avatar May 10 '23 15:05 themattmorris

I think adding anything after the language will make check_code_block deem the codeblock as invalid and filter it out in grab_code_blocks. I.e

``` python asdfIGNORE

collindutter avatar Jan 10 '24 20:01 collindutter

There are things that are reasonable to put behind the tickets besides the language. Some markdown providers will allow for line highlighting via things like:

```python highlight=12-14

So I wouldn't assume it's immediately invalid if there's anything after.

koaning avatar Jan 12 '24 14:01 koaning