Markdown Tables

Update: After writing this post, I built a tool to help encode these templates. See the bottom of this post for more info.

After posting my Beer Log action for Launch Center Pro yesterday, I got a couple of questions about how to generate those pretty tables in Day One.

Day One has extensive support for rendering Markdown. In fact, it supports MultiMarkdown, which is a superset of Markdown that includes some additional goodies like footnotes and–most importantly–tables.

Even though you can create tables with Markdown, most people don’t. The syntax is really quite ugly. Here’s an example:

| First Header | Second Header |         Third Header |  
| :----------- | :-----------: | -------------------: |  
| First row    |      Data     | Very long data entry |  
| Second row   |    **Cell**   |               *Cell* |  


The inimitable Dr. Drang wrote a detailed explanation of Markdown tables, so I’ll link to that here rather than try to write my own explanation. His is quite good.

Deconstructing the coffee log

The raw Launch Center Pro (LCP) action that Ben Tsai released is URL-encoded. It has to be in order for LCP to understand it. For us to customize it, it would help to decode it. You can do this in one of several ways. TextTool for iOS has encode and decode functions. For creating the Beer Log, I used this web-based tool by Eric Meyer.

Here’s the original Coffee Log after decoding:

dayone://post?entry=#coffee #log

|Brew method|[list:Brew Method|AeroPress|Chemex|Drip|Espresso|French Press|Pour Over|Other]|
|Brewer|[prompt:Who brewed it?]|

Now that we can read the Markdown table syntax, customizing the table is pretty straight-forward. Note the fields inside square brackets. Those are specific to LCP.

Before installing it in LCP, you’ll need to re-encode your action again once you’re done tweaking it. This is where it gets tricky.


You can’t just re-encode the entire string. Looking back at Ben’s action, parts of the URL are encoded, and other parts aren’t.

%7CBrew%20method%7C[list:Brew Method|AeroPress|Chemex|Drip|Espresso|French Press|Pour Over|Other]%7C%

If it were completely encoded, it would look like this:


See the difference? It’s the square brackets (and everything inside them).

If the square brackets end up encoded along with the rest of the string, LCP won’t understand it. You won’t get any prompts or lists, and your action will silently fail, or the app will throw an error.

Instead, you’ll have to encode your string piece by piece. Encode everything that isn’t inside square brackets, and piece your URL together.

Yes, it’s a pain, but I haven’t found an easier way to go about it. You’ll probably have to debug syntax errors along the way, but if you’re careful, it shouldn’t take long to get the hang of it.

Update: This app can handle the encoding for you. You can build your entire table in the editor, then click the Encode Template button. Code for the app is available on GitHub.