If you’re doing any custom markdown rendering, something you should demand of your Markdown library is access to the abstract syntax tree.
For Ruby, that includes Kramdown, CommonMarker, and Markaby.
In JavaScript land, Markdown AST parsing is what makes MDX possible for embedding React components in Markdown.
For Joy of Rails, I author content in what I call MDRB.
Inspired by MDX, it’s my own flavor of mixing ERb into Markdown so I can create interactive articles from what initially renders as static content.
The magic comes from walking the Markdown syntax tree parsed by CommonMarker to produce highly customized HTML.
This example demonstrates how you could parse a Commonmarker markdown document into an abstract syntax tree to customize the output. Each `node` provides a `type` to switch on behavior and an `each` method for iterating over its direct children.
Correction: *Markly
• • •
Missing some Tweet in this thread? You can try to
force a refresh
As a senior engineer in a large(ish) remote organization, I’ve had to lean on diagrams more and more to communicate software design. A picture really is worth a bunch of words.
I’ve previously worked on smaller, co-located teams where diagramming was pretty rare, perhaps a whiteboard session every now and then.
With a large org, more teams, and more moving parts, less of the application can fit in everyone’s heads. Shared understanding takes more effort.