Experimentation with Markup Languages

A new, ill-devised but well-implemented markup language..


I have recently came back onto an old side project to learn about scanning and parsing in Rust without the use of outside tools (just me and the standard library) and it led to an interesting markup language being created which was a joke at first but became something bigger.

The language I am speaking of looks like this:

hello there, this is valid markup

Yep. Space seperators.

This translates into the following JSON:

{"hello": ["there,", "this", "is", "valid", "markup"]}

At first this may seem odd and quite unsafe but by using the same techniques as json for string escapes, this markup can store something like {"my title": "content"} safely with the use of backslashes:

my\ title content

This was just a quick showcase post, if you’d like to see the source code it’s hosted on GitHub, the links to which is in the section below. The crate has no dependencies and is extremely lightweight at only ~330 lines (including tests)!

PS: I’ve also recently updated the package so you can use the more boring looking key:value or key=value, the latter could be used as a full argument parser if you modified the library to allow just key to be valid (it’s not as there is no JSON translation).