Closed dopatraman closed 3 years ago
Good question!
One pattern useful in all tree languages is to add a nodeType that parses it's contents in a different language.
For example:
titleMarkdown
Here is my [link](url)
A compile()
method on that node type
might use a markdown library and call a
markdownToHtml()
function.
Another option would be for the base node type in Dumbdown to support some type of string formatting. I would say this is possible but the former is probably the better initial approach, and then people could try all sorts of ideas for inline formatting. Then maybe one will come out so awesome that it makes sense to incorporate it into the base Dumbdown nodes.
people could try all sorts of ideas for inline formatting
That would be fun, but also confusing & hard to standardize. Part of the attraction of MarkDown is it has a standard, so no matter where you go, it is 95% the same.
Good points @tomByrer .
Beyond the basics of Tree Notation (words in cells, indent for parent/child edges), I haven't spent enough time on what great higher level standards would be.
I think one approach that seems to be promising is to focus very hard on concatenative grammars, so that you may have "common/standard" node types, but the real standard is on how those can be combined together.
Or in other words, dumbdown could contain any type of node definitions, and the standards are more around how those node definitions are defined and fit together.
Just thinking out loud.
A concrete example:
Here is the Dumbdown prototype.
And here is the same thing but I've extended the grammar with a new node type, a horizontal line:
horizontalRuleNode
extends abstractTopLevelNode
compiler
stringTemplate <hr>
crux *****
So we could have a tiny "core dumbdown", and then an easy standard way of extending it to build more specific dialects.
For now what I've found works good enough is to just write raw HTML for inline styles like bold and italics and links.
Let's say i want a link in my title:
Parentheses allow you to insert other constructs into a line.