As the link for the no-op shortcode in bep's answer seems to be broken, I will post my solution of a comment shortcode here for anyone who gets to this in the future:
You can simply add a shortcode, lets name it, for example, "comment.html". We want to use a paired shortcode (i.e., one with a starting and closing shortcode) and put our comment inside. To achieve this, the shortcode must evaluate the .Inner variable. If .Inner is not evaluated, Hugo failes to build. Since we do not want the .Inner text in our HTML output, we can for example store it in a variable or evaluate it in a condition.
Therefore the shortcode file "comment.html" could contain something like:
{{ if .Inner }}{{ end }}
and in your markdown, you can use it as follows:
{{< comment >}}
this is a comment
{{< /comment >}}
The resulting HTML will not contain the comment in its source code.
<!-- the text -->
– Bolden-->
tag thanks – Inhabitant