Mark Zero: Motivation

When I first began setting up this site, I was writing HTML by hand. It wasn't too bad at first. In fact, writing HTML wasn't that bad at all. My troubles began when editing my work. Keeping track of tags with large amount of content was a challenge, and for my voting systems article, I had to write a few formulas by hand in MathML. That settled things. I needed a lightweight markup language.

There were established options available, but out of curiousity I decided to implement my own. First, it just had headings and paragraphs. Then, it had bold and italics. Then links, and images. All simple enough.

The real turning point came when I decided to add lists. Headings and paragraphs are separated by blank lines, so they are not very hard to implement. Lists, on the other hand, require indentation sensitivity.

Additionally, I am quite particular about how I write my lists. In a technical writing course, it was drilled into me that lists should not occur without at least a bit of prose before them. As a result, I do not like to separate my lists from the surrounding paragraph. When I was working out the details for Mark Zero, I sat down to figure out how I would write a list in plain text, and this is what I came up with:

Beginning of paragraph
  - Item 1
  - Item 2
and so on.

That is, I indent the list to distinguish them from the surrounding text.

Around the same time, I had the idle thought that it might be convenient to implement some custom styling. All I needed was a single token to indicate a custom block, and I could just give the result a class and style it with CSS. Having written quite a bit of LaTeX in college, the syntax \command was a natural choice.

Since I was already going to implement indentation sensitivity to deal with lists, I decided to allow other blocks to be nested. I figured that I could squeeze a great deal of flexibility out of a feature I already had to implement. I quickly became attached to the idea, and the result was Mark Zero.

Code Blocks

With custom blocks, the version of Mark Zero described above is surprisingly capable. You can, for instance, neatly align a group of images with a custom \flexbox command or have an admonishment:

\admonishment
Beware!

For a programmer, though, one feature was notably missing: code blocks. At first, I went with the usual fenced code block design,

```
int main() {
  printf("hello world\n")
  return 0;
}
```

but when mixed with other blocks, I found that it did not fit with the rest of the language. Moreover, I developed Mark Zero to run in the browser, and I did not like how unmatched backticks would turn the entire display into an unreadable mess of a code block.

I decided instead on the | character, one per line. As such, the above would be written:

| int main() {
|    printf("hello world\n")
|    return 0;
| }

I tried a few other characters, but they just looked cluttered and made the source code harder to read.

IDs and References

IDs and References are Mark Zero's the most recent features. An ID can be attached to a block or a span with the #id syntax. The resulting HTML element will just have that ID. You can reference to the ID via the @id syntax.

While IDs are at least useful for linking to locations in the same page, the purpose of references is not immediately clear. They seem redundant with links. The difference becomes more clear with the introdcution of prefixes. A prefix is written like @prefix:some-id, and the corresponding ID should be declared #prefix:some-id. These elements are implemented in a prefix- and application-specific manner.

The only prefix currently supported is fn:, which denotes a footnote. Footnote references (@fn:some-footnote) are automatically numbered and linked to their definitions, and footnote definitions (#fn:some-footnote) are also numbered, backlinked to their references, moved to the end of the page and sorted based on the order in which they were referenced.

So, while one could probably implement IDs and references with commands and links, the each pair of features expresses a fundamentally different intention. Commands and links are a do-what-I-say feature, whereas IDs and references are a do-what-I-mean feature.

IDs and references are intended to be handled in an application-defined way. For instance, a forum using Mark Zero as its markup language could implement the user: prefix to allow automatic linking to user profiles. Meanwhile, a book-preparation system could implement def: to automatically place definitions in a project-wide glossary. As such, references can refer to resources defined outside of Mark Zero entirely, and definitions may generate new files or affect the contents of other files than the ones they written in.