Question: How can I change the default behavior in the markdown filter so that it transforms a newline to a br tag?

Answer: 
**EDIT: As of the end of June, 2011, the extension below is now included with Python Markdown.**

Here is a Markdown extension that I wrote and am currently testing on my site to do exactly what you want:

```
"""
A python-markdown extension to treat newlines as hard breaks; like
StackOverflow and GitHub flavored Markdown do.

"""
import markdown

BR_RE = r'\n'

class Nl2BrExtension(markdown.Extension):

    def extendMarkdown(self, md, md_globals):
        br_tag = markdown.inlinepatterns.SubstituteTagPattern(BR_RE, 'br')
        md.inlinePatterns.add('nl', br_tag, '_end')

def makeExtension(configs=None):
    return Nl2BrExtension(configs)

```

I put this in a file called mdx\_nl2br.py and put it on my PYTHONPATH. You can then use it in a Django template like this:

```
{{ value|markdown:"nl2br" }}

```

If you'd like to use it in regular code, you can do something like this:

```
import markdown
md = markdown.Markdown(safe_mode=True, extensions=['nl2br'])
converted_text = md.convert(text)

```

[Here is the starting point in the docs](http://www.freewisdom.org/projects/python-markdown/Extensions) for using and writing extensions.
There appears to be a `linebreaks` filter that converts `\n` characters to either `<br>` or `<p>`.  

See [linebreaks](http://docs.djangoproject.com/en/dev/ref/templates/builtins/#linebreaks) or [linebreaksbr](http://docs.djangoproject.com/en/dev/ref/templates/builtins/#linebreaksbr).