{main
{h1 Title}
{p
Paragraph 1.
{{a {href google.com}} Here is a link.}}
{p
Paragraph 2, now with {b bold} text.}}
The nice thing about HTML/XML is that it's a clear data-structure, so you can essentially read it in any format you like and convert that to the underlying tree structure without much issue. That's why it's been so successful, basically the same philosophy as a lisp. Why someone would look at that and think "let's go back to a document with no clear structure" is beyond me.Replace the braces with parens and you can parse that into a tree with only a handful of lisp macros.
(define (code-block file-name)
{pre {{code {class block}}
#(cmd "highlight" (thisdir (string-append "posts/" file-name))
"-O" "html" "--inline-css" "--fragment"
"--line-numbers" "--line-number-length" "3")}})
And it fits quite nicely with surrounding code. The mapping of these curly expressions to Scheme ones is relatively simple, though there is
a special case for joining words to brackets. {a {b} #c #@d} => `("a" ("b") ,c ,@d)
{a {b}c} => `("a" ("b") join "c")FWIW, my first static blogging system (circa 2003) did almost exactly the same thing you are doing (except that I used `[]` for lists, not `{}`). IIRC, it was maybe 5-6 macros+functions (and some readtable magic) to turn every `[foo ...]` into `<foo> ... </foo>`, with support for attributes using `:name=value` syntax and a list of exceptions for non-closing tags such as `<br>`, etc.
I redid something like that recently, in C, and it turned out to be unreasonably larger to write than in Clisp.
TBH, these days it's better to simply stick to markdown, because the tooling is much better (previews as you type, tools to automatically generate the html, inline HTML for what markdown won't do, etc).
<table>
<tr>
<td>first row, first column
<td>first row, second column
<td>first row, third column
<tr>
<td>second row, first column
<td>second row, second column
<td>second row, third column
</table>
Does it get any better in markdown? | first row, first column | first row, second column | first row, third column |
| ------------------------ | ------------------------- | ------------------------ |
| second row, first column | second row, second column | second row, third column |
To me, this is more readable than the HTML version. | first row, first column | first row, second column | first row, third column |
| ------------------------ | ------------------------- | ------------------------ |
| second row, first column | exceptionally long second row, that makes second column look worse | second row, third column |