1/N: This is kind of illustrative of the current state of my "thought process" in These Modern Times.

I still use Mutt, a terminal-based email handling program. Mutt makes you focus on what's important -- the body of the email, and leaves everything else for external programs.

2/N: Now it also happens that I'm a fan of Markdown, a very lightweight document markup syntax that lets you apply some modest styling to your writing without making your source document unreadable. As an example, if you wanted to emphasize some text in HTML, you'd have to do it <STRONG>like this,</STRONG>, but in Markdown it's done **like this.** In other words, Markdown adds syntactical meaning to the kinds of emphasis markers we'd likely add to plain text files.

3/N: Mutt can render plain text, and it can also render "enriched" text -- an obscure standard no one uses, because it suffers from similar readability issues as HTML. But it doesn't do anything with Markdown, just displaying the source code.

Well, no problem, Mutt can push the email body through an external filter program. This is how HTML-formatted email is made readable in Mutt, by piping it through `w3m` or `elinks` or `lynx`.

4/N: In the case of Markdown, there's a rather nice tool called Pandoc which can translate between a huge number of text document formats. One of the supported input formats is Markdown. And one of the output formats is ANSI -- the most popular codes for controlling text appearance on a terminal.

Problem: The default ANSI output styling from Pandoc is kinda crap.

Another Problem: The ANSI output is handled by an external library called Skylighting.

5/N: Yet Another Problem: Skylighting has no obvious way of controlling the mapping from Pandoc styles to ANSI escape codes. So if it thinks italic text should be rendered in a different color, it appears in that color, even if your terminal and font both support displaying actual italicized text.

6/6: So I'm sitting there, wondering what alternatives might be available, when it occurred to me: Why is Pandoc's only terminal writer for ANSI? Why isn't there an `ncurses` writer, which would support whatever TERM is set to? So I thought, "Maybe I could write this myself." And the user could set mappings from Pandoc styles to ncurses attributes...

...Pandoc, and all of its readers/writers, are written in Haskell.

Yes, there is a Lua interface -- it's unclear whether that's enough.

@ewhac Well, there are many markdown parsing libraries for (your favorite programming language), and ASCII terminal libraries as well - maybe you just need to whip up some glue code. Might be a fun project!

@talin
( /me pokes around in Crates.io, looking for Markdown parsers and Terminfo helpers )

Y'know... I could probably get about 80% of the way there without an excess of pain...