Using Markdown for Text Formatting

I’m working on a game engine that has clients in a variety of different platforms, including web-based and command-line clients. One of the issues I have is how to implement platform-independent text formatting. Right now I’m experimenting with supporting Markdown.


  • Easily converted to HTML
  • Possible to convert to ANSI/VT100 for command-line and terminal clients
  • Possible to mix with regular HTML
  • Readable as unformatted text


  • May be unfamiliar to many authors
  • ???

Does Markdown support seem like a useful thing? Is something like Inform’s bracketed formatting preferable? Are there any other options I should consider?

I am a big fan of markdown for web pages and blog posts. However, for a game engine you expect people to generate variable text; that means some template-like feature. Inform’s brackets serve that need. (Other syntaxes are used in the web-template world.)

You may also find that markdown is too HTML-centric. It’s great if you expect people to use numbered lists, headers, images, and hyperlinks. However, if you don’t, then you have to figure out what to do with those constructs (particularly in the terminal-window world).

Yes, Fred/Gamefic, are you Infom7-savvy at all? Inform7 lets you do really nice things with those bracketed expressions in strings.

Of course, Ruby already has built-in templating using #{variable} etc, or you can use something like Mustache.

That also goes for conditionals in strings like

The description is "The mirror is [if the mirror is cracked]cracked, showing you a hundred views of the world[otherwise]still intact[end if].";

But Inform also lets you do things like

say "[one of]red[or]green[or]blue[purely at random]"

some of those things like [stopping] or [first time only] are pretty neat. TADS3 also has similar constructs like <>…<> (if I remember it right). I’m not sure whether Gamefic need something special for that or if you just do it in Ruby.

This other question is about using markdown in the output and have a presentation layer pick up on that. Again, Inform7 uses bracketed expressions like [bold type]. Like zarf says, it’s worth thinking about text-only versus GUI outputs. Maybe markdown for bold, italics etc, but also allow custom markup using CSS classes and just have that stripped out for text-only output?

I don’t like markdown because its syntax can easily mess with the rest of the text, for example in this_is_variable the _ will be interpreted as italic. It’s also quite limited, you can’t underline or strikeout text.

I prefer txt2tags which is older, more logical and more extensible.

I see the points about Markdown’s limitations. If you need control over things like font styles and color, Markdown alone won’t cut it.

Peter: One limitation in Gamefic is that an entity’s description is static. You can use #{variable} in the description string, but it’s only processed the first time you load the game. If you need the description to be dynamic, you need to create a custom action for it. The cracked mirror example would look something like this:

respond :look,, mirror) do |actor, mirror|
  actor.tell "The mirror is #{mirror.cracked ? 'cracked' : 'intact'}."

I like the idea of using something like Mustache. That could make it possible for the description to be something like “The mirror is {{cracked? ‘cracked’ : ‘intact’}}.” without the need to override the action.