Parsing semistructured text as markup is a problem solved over 30 years ago [1].
SGML has the SHORTREF feature which allows custom Wiki syntaxes such as markdown, but also casual math. It works by applying a context-dependent (parent element dependent) mapping of tokens (such as the `_` token for markdown emphasis) to replacement text (eg. the `<b>` start-element tag). Within the `<b>` context, the `_` token is mapped to the `</b>` end-element tag, in turn, ending the emphasis. In combination with tag omission/inference (such as in HTML) and other markup minimization and processing features, SGML is a quite powerful plain text document authoring format.
We may be talking about different things. Parsing valid, standard-conforming HTML/Markdown/whatever is a solved problem. Getting multiple parsers to deal with arbitrary tag soup, authoring errors, variously-supported extensions etc in a consistent way is a lot uglier. The problems may be commercial/political/educational/organizational rather than technical, but that doesn't mean they aren't real.
SGML has the SHORTREF feature which allows custom Wiki syntaxes such as markdown, but also casual math. It works by applying a context-dependent (parent element dependent) mapping of tokens (such as the `_` token for markdown emphasis) to replacement text (eg. the `<b>` start-element tag). Within the `<b>` context, the `_` token is mapped to the `</b>` end-element tag, in turn, ending the emphasis. In combination with tag omission/inference (such as in HTML) and other markup minimization and processing features, SGML is a quite powerful plain text document authoring format.
[1]: https://en.wikipedia.org/wiki/Standard_Generalized_Markup_La...