I built a new little API for you. It generates Markdown Lorem Ipsum. First, a little background.

Why?

As I’ve mentioned elsewhere, I’ve been playing with Text Blaze, a cool new app that might eventually replace TextExpander for me. One of the major things missing from Text Blaze, though, is script snippets, which I make use of a lot in TextExpander. What it does offer, though, is a command for fetching a REST API and processing the result. A lot of my script snippets are doing just that, so those are actually more convenient to build in Text Blaze. For the ones that need extra handling, I’ve just been creating web endpoints that run my scripts for me.

When you go to the Text Blaze home page it looks like it’s just a Chrome extension. You have to go all the way to the bottom of the page to find the Mac app (beta).

One such snippet I wanted back was my random Markdown generator, which I use frequently to test out styles for things like Marked, nvUltra, or MultiMarkdown Composer. There’s an existing API called Lorem Markdownum, but it doesn’t generate enough of the syntax consistently to be good for testing themes. So I built my own.

MD-Lipsum

“MD-Lipsum” uses Loripsum.net to generate a full set of HTML markup with random text, and then converts that HTML to basic Markdown. No tables, unfortunately, but it outputs a complete set of standard Markdown elements, including bold/italics, ordered and unordered lists, headers, block quotes, code blocks (fenced), and definition lists (MultiMarkdown syntax).

Usage

To use the API, just point to https://brettterpstra.com/md-lipsum/api/1. You can add /long or /short but it has minimal effect (a shortcoming of the loripsum.net API, I think). It just returns plain text, much like the TitleCase API I made a while back.

You can use it from the command line like:

curl 'https://brettterpstra.com/md-lipsum/api/1'

To use it in Text Blaze, you’d want a snippet like:

{urlload: https://brettterpstra.com/md-lipsum/api/1; done=(res) -> ["response": res]; headers=; body=; method=GET}{=response}

There’s a little page here but it just tells you what’s in this post!