How to color code headings in TextMate using Markdown

Posted by Trey on May 21, 2007

Preferences > Fonts & Colors

Add a new element entry like so, using the scope selector markup.heading (this doesn’t seem to effect H tags in HTML):

Custom Colors in TextMate

Use whatever foreground and background colors you want.

Project-Specific Self-Closing Tags in TextMate

Posted by Trey on May 18, 2007

If you want to switch to using self-closing tags like <img /> and <br /> in certain projects, change the shell variable TM_XHTML for that project to ” /“.

Click here:

Project Variables Button

Enter this:

XHTML for a specific project

The default behavior for TextMate is to use HTML 4, so you don’t have to do anything extra for those projects.

OLs in IE

Posted by Trey on October 09, 2006

If you set an OL LI to have height: 1% (to trigger has-layout) in IE, the number won’t increment. Freaky.

Using Markdown in Rails apps with BlueCloth

Posted by Trey on October 01, 2006

RedCloth seems like a bad idea for doing Mardown, since it wants to do Textile first then degrade to Markdown or some such nonsense. Markdown = more better, IMO.

Download BlueCloth gem

sudo gem install ~/Desktop/BlueCloth-x.x.x.gem

Syntax:

<%= markdown(@item.description) %>

XHTML vs HTML

Posted by Trey on October 01, 2006

If XHTML served as text is really just invalid HTML that renders predictably, then why does a document with a HTML 4.01 strict doctype still validate with XHTML type self-closing tags (<img src=”#” />)?

Update (Oct 25, 2006): I like this!

Getting Markdown to work with Django

Posted by Trey on September 20, 2006

In your view template put:

{% load markup %}

In your settings.py in the INSTALLED_APPS section, put:

'django.contrib.markup',

Install the Markdown library:

Download

Install on OS X:

Download markdown.py and setup.py and run:

python setup.py install

This is what happened on my system:

running install
running build
running build_py
creating build
creating build/lib
copying markdown.py -> build/lib
running install_lib
copying build/lib/markdown.py -> /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages
byte-compiling /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/markdown.py to markdown.pyc

I wonder if that was the wrong way to do that. It looks like it modified my system version of Python, which means if the system updates it, it will be overwritten, right?

Install on DreamHost

Croft tells it like it is:

Basically, you just want to put the markdown.py file anywhere in your Python path. The simplest way is to just drop markdown.py in your django_projects directory. A slighty more complicated, but cleaner way (and actually the way I did it) is to create another directory for Python modules like this. I created a directory at the root of my Dreamhost account called “pylib”. You then need to add this directory to your python path by adjusting .bashrc and django.fcgi accordingly. If that makes sense, go for it. If not, just drop markdown.py in your django_projects — that’ll work fine.