scroll
scroll copied to clipboard
💡 grammar node in a post
Sometimes you might want to create a node type on the fly.
Example #1: These 3 files [https://github.com/breck7/breckyunits.com/tree/main/markups] could really be just 1.
Example #2: In this post: https://github.com/breck7/breckyunits.com/blob/main//how-james-park-built-fitbit.scroll
Instead of this:
paragraph
<b>Guy:</b> Wow.
paragraph
<b>James:</b> Yeah. I don't think I quite knew what that meant back
You could have something like:
grammar
guyNode
extends paragraphNode
crux guy
compile <b>Guy</b>: super.compile
guy
Wow
james
Yeah. I don't think I quite knew what that meant back
Moving imports upstream to the Tree Notation level (probably emulating a combo of Racket's "#lang" with Deno's url imports), seems to be more universally useful. And then you could easily add grammar nodes to a post by importing the Grammar language in the post first.
Here is the upstream Grammar issue: https://github.com/breck7/jtree/issues/106
v28 now supports defining new node types right in a scroll page.