3 ms·
Yeah, and that's not really equivalent HTML either. That's more like: <p> <text>This is</text> <b><text>bold</text></b> <text>text.</text
by byuu 12y ago
Yeah, and that's not really equivalent HTML either. That's more like:
<p>
<text>This is</text>
<b><text>bold</text></b>
<text>text.</text>
</p>
(which is a lot easier for a machine to parse, at least.)
JSON and YAML are great for what they do: data serialization, but they're just not appropriate choices for text markup. You have to use the right tool for the job.
There was a time when the industry wanted to cram 100% of everything into XML, and that gave us XSLT, XAML, SOAP, etc. We don't want to go back to that, either.
Personally, I'm most fond of an extended Markdown syntax to replace HTML. But I'm not going to hold my breath waiting on web browser vendors to agree on such a syntax, so instead I have my HTTP server do the conversion to HTML for me.
But if you had to force it into JSON, then I would suggest using a different markup for inline elements, eg:
html
body
p: "This is [/italic/] text."
p: "This is [[google.com => a hyperlink.]]"