Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With SGML, there is a powerful standard and prior art. SGML SHORTREF declarations let you define most of markdown's span- and block-level syntax by mapping tokens to start-/end-tags or any other replacement string in a state-dependent fashion such that eg toggling bold text on and off is easy, with special recognition of newline/end-of-line "tokens", etc. The mapping to HTML is very natural, also because using in-line (or block-level) HTML angle-bracket markup tags works exactly as in markdown. Though unlike markdown, SGML will complain about syntax errors, rather than format incomplete markdown syntax as verbatim text, and markdown "referential links" put anywhere before or after the place where it is referenced won't work.

Text macros (entities) come for free with this approach, and SGML SHORTREF customizations also can be used for any number of additional document-specific conventions on top of markdown.

Even if not actually using SGML but one of the hundreds of markdown-to-HTML converters, checking for SGML upward compatibility is a useful thing to do IMO because of the already crowded space of tokens recognized in marked up text and their recognition priorities.



I've heard this before. It sounds good, but where to start?


For markdown-in-SGML specifically, there's a tutorial at https://sgmljs.net/docs/producing-html-tutorial/producing-ht... also covering usage of entities/text macros.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: