Building your own flavored Markdown with Ruby
summary
Shows how GitLab’s Markdown is implemented in Ruby by extending Kramdown into a real transpiler: lexical scanning with StringScanner tokenization, rule-driven parsers that emit a Cramdown AST, and HTML conversion via the existing converter. Demonstrates tricky regex fixes (switching to non-greedy regex to avoid catastrophic backtracking), ordering pitfalls, and when find-and-replace fails. Includes code-level patterns for commit/mention parsing and how those become HTML links.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:57What is Markdown
- 4:51Text to HTML conversion
- 7:06First parsing attempts
- 11:53Regular expressions
- 19:57Block level markup
- 20:19Compilers and transpilers
- 23:15Lexical analyzer
- 27:12Tokenization
- 29:00Abstract syntax tree
- 30:32Real-world usage
- 32:02GitLab Flavored Markdown
- 35:35Code implementation
- 40:09AST examples
- 43:12Q&A and closing








