Why are some markdown headings not converted to the proper html heading?

You are in a frustrating situation, some headings marked with # are not getting
converted to their rendered HTML counterpart.

Some do get converted, it is quite confusing. You retype the header.
Now it works but you did not change anything.

If You try a different markdown renderer it may or may not have the same output,
making this issue hard to diagnose.

This issue for example does not exist in hexo but it does exist in hugo.

Solution

You are too fast. You are writing the header with the combination of
Option+3 or Alt+3 to type the #s, and then quickly hit Space, mistakenly hitting Option+Space.

This space is getting converted to a non-breaking space.

You can use https://dillinger.io to validate your markdown file, and it will
display the issue clearly:

Alternatively, we can check it with a hex heditor:

The solution is to replace the non-breaking space with a normal space, and slowing down. :)