Both are valid syntax. Some folks prefer one over the other, as they read slightly differently in plain text (when the Markdown is not rendered as HTML) and in Git diff files.
As far as I know, there is not official guideline, so you can use whichever you want when writing docs. (And if you ask me, there are many aspects of writing docs worth agreeing upon before spending time debating header syntax in a guideline, so I would really not worry about it! YMMV)
One more note in addition to information provided by @gonzalo-bulnes. There are more than two. For example Github supports many.
Similarly, most of them could be converted to a manpage.
For personal use, it would be your own choice. For contribution to other projects (e.g. Qubes OS CLI manuals), my advise is to continue using the existing format in target repository (usually reStructuredText, Setext, troff, …). Fortunately learning most those formats is pretty easy.
Not talking about different formats here @alimirjamali, only different syntax for Markdown. Makes sense? (That doesn’t remove anything to what you said, only that I think syntax in this case is inconsequential.)