Try it!
Visit the GitHub Repo
Description
Challenges: Parsing Markdown correctly across headings, code blocks, inline code, links, and nested lists without pulling in an external parsing library. The main challenge was handling edge cases in the line-by-line parsing logic without a formal grammar.
Result: A working CLI tool that converts Markdown files into styled HTML — handles all standard elements including headings, code blocks, lists, and links. Serves as the foundation for generating styled article pages from plain Markdown source.
How the Parser Works
In Action
CLI proof points
- Markdown input turns into styled HTML without writing page markup by hand.
- Go standard-library code keeps the converter small and dependency-light.
- Stateful parsing handles multi-line blocks instead of treating every line alone.
Generated HTML proof points
- Block detection chooses the wrapper tag before inline transforms run.
- Inline transforms cover bold, italic, code, and link syntax in a predictable order.
- The output can be dropped into static documentation pages.
Dev Notes
Problems Solved
Writing raw HTML for documentation by hand was tedious and error-prone. I needed a CLI that accepted Markdown as input and output styled HTML pages — and building it in Go was a chance to learn the standard library on a real task.
Errors & Fixes
The line-by-line parser broke on nested lists and code blocks that contained blank lines — it would close the block early and emit malformed HTML. Fixed by adding a state machine that tracked open block contexts across lines instead of processing each line independently.
What I Learned
Go's bufio.Scanner, string manipulation with the strings package, and CLI flag design with os.Args. More broadly, how stateful line parsing works and why a formal grammar is worth the extra effort on complex inputs.
Back to top