vi gem

I’ve been using “vi” (a popular unix text editor) for about 15 years. Today I learned something important. Vi has bookmarks that can be used for doing stuff with blocks of text easily.

Continue reading


Markdown Extra Improvement

I’ve been using Markdown Extra for formatting posts and pages for a new site I’m working on. Since I want the back-end editing to be as simple as possible, I wanted to remove the “two spaces at the end of the line” requirement when the user simply wants to insert a line break.

The change was very simple. In markdown.php I just changed line 757 from this:

$text = preg_replace('/ {2,}\n/', "<br$md_empty_element_suffix\n", $text);

To this:

$text = preg_replace('/\n/', "<br$md_empty_element_suffix\n", $text);

The original Markdown author intended the “two space” behavior so that you could be more explicit with your line breaks and make the most clean “human readable” markdown text. This is particularly nice when you want to break up some text over multiple lines for formatting like:

* This is a multi-line bullet point and I want it to be together

With my change, that has a line break after “bullet”. I expected this hack to break lots of things but so far, I haven’t noticed any negative side effects. I’d be interested to hear if anyone tries it and notices any problems.