This isn't specific to Nim. Nim's runnableExamples is a close cousin to D's unittest blocks; as in D, unittest blocks are not embedded in documentation even though they end up in documentation and can be run from html. A difference is that unittest block appears right after proc body, rather than right after proc header (which has pros and cons but the self contained aspect of it is nice).
> I expect nim doc to throw an error when it tries to compile the > runnableExample block, unless it is ignored. But it doesn't. Am I missing > something here? thanks for reporting this; but please report as github issue next time instead of forum to increase change it gets fixed; just sent out [https://github.com/nim-lang/Nim/pull/9262](https://github.com/nim-lang/Nim/pull/9262) to fix this particular case; the more general case would be to fix [https://github.com/nim-lang/Nim/issues/9216](https://github.com/nim-lang/Nim/issues/9216) but that's a separate discussion
