My 2 cents: in markdown-exec, we hide lines that contain markdown-exec: hide
, which can be appended as a trailing comment in most languages.
print("hello") # markdown-exec: hide
print("world")
Docs here: Usage - Markdown Exec. I could support nodoc
is this becomes a thing or gets requested