The simplified rules for the em-dash are pretty much intuited and prescribed versions of this which gut the effectiveness of em-dash. In general use an em-dash should be used to denote thoughts without having too restructure/delete what you just wrote to accommodate that thought.
Edit: I oversimplified. Consistency is what is important, using an em-dash like a comma that isn't a comma leads to ambiguity when you also use commas. A writer who avoids semicolons and quotes all dialog can use an em-dash very differently than raising the voice, but they can also use a semi-colon very differently than its standard accepted role, that is what these simple guides miss, the consistency of usage, they just list all of the various ways you could use any given mark and people start using an em-dash to "fix" their long run-on sentence with all of its commas.
The closest thing we have to standard use allows for wonderfully complex sentences which can convey great meaning but consistent and well defined use is most important.
comma - connects independent and dependent clauses
em-dash - raises and lowers the voice
semicolon - connects independent clauses in a more direct way than the paragraph
colon - elaborates an idea
parenthesis - an aside, stated instead of thought
period - end of thought
Question mark and exclamation points do not need to be at the end of a sentence, they can double as comma, semicolon, or colon.
I seem to be missing a nuance of HN's line breaks and formatting.