Texopic typesetting language
Texopic typesetting language was made after I had enough about Sphinx docs, RST and Markdown.
All popular and current formats for documentation use plenty of characters as syntax. It makes it difficult to estimate what the output is. They also have an another problem that appears if you desire to do something beyond their feature set. What if I really wanted to pimp up my documentation? If I did that in markdown, it'd mean for writing an extension.
Would the markdown extension mess up with my other documents written in markdown? Sure it would if I'm not careful. There are just N amount of sensible notations for meaningful things. Does markdown have an #include? No. Well... we get to the problem here.
Those languages weren't meant to be extended. How about TeX then? TeX is actually pretty good, but you need TeX to read TeX documents. There the idea of a language and the program are mixed into one. It's challenging to retrieve several different formats from a TeX document.
I'm not fond about writing TeX because I'm not fond about writing document processing programs in document processing languages. I don't use TeX. But TeX has lot of good things and I made Texopic from that good stuff.
Simplified syntax
Many formats meant for documentation have a rich syntax. TeX is the worst as the interpretation depends on the state of the document processor. The approach it takes with building the document is okay though, but more on that later.
I wanted to optimize my typesetting language for plaintext-writing. I assume that the writer treats writing of the document and the representation of the document separately. You don't want your plaintext to trigger a macro by accident because the mess it produces is distracting from producing the text.
Texopic has only one character '#' which triggers a macro generation. If the macro is not present or it cancels, it is written out as a literal representation of itself. Author only needs to worry about handful of rules the text satisfies.
I also made it easy to embed non-texopic languages into Texopic. I thought that whenever you have a complex thing to represent, you have an approriate format to represent it. That's where the preformat-macro-block (##) came from.
Paragraph builder
Texopic is meant to be processed with a system that recognizes the input stream into "paragraphs" or groups. It is a bit similar to how TeX works through the input.
The group builder can be in some of following modes:
- Vertical mode - building a vertical list.
- Horizontal mode - building a horizontal list, a paragraph or a group.
- Restricted horizontal mode - building a horizontal list, suspending commands to start new vertical elements.
When the paragraph building is itself sufficiently functional, the restricted horizontal mode can suspend commands by throwing an exception and catch it during macro evaluation.
Difficulty
Texopic processor should have a customizable interface to build an any document. This makes it difficult to implement.
Building the processor in whole was like a difficult puzzle. There was so many things that interact together in nonobvious ways.
Why not do HTML?
You may wonder why I bother? Shouldn't I use HTML for documents?
I had a moment when I was writing websites with just plain HTML. There are several problems in doing that.
- HTML is pain in the ass to parse with everything I need, this would get to me because I need non-browser printouts of my documents.
- Whatever shown on the browser has to be written into your HTML document. HTML templating isn't quite where it should be.
- HTML has an identity crisis. Nobody knows what it should be. Some want it to represent semantics of the document and whatnot. Actually it has turned out to be a display language for most programmers. We use it to display stuff on your browser.
- Writing HTML is self-repetitive and tiresome in practice.
Texopic still needs few improvements before it can replace HTML for me. I think I'll get there soon.