title: How to configure 'less' to show formatted markdown files?
body: <p>I would like to have <code>less</code> display <code>*.md</code> markdown files with some formatting -- like I know <code>less</code> can, for manpages, etc. I am running Ubuntu 12.04.</p>
  
  <p>I am as far as putting a <em>user defined filter</em> into <code>.lessfilter</code>:</p>
  
  <pre><code>#!/bin/sh
  case "$1" in
    *.md)
      fn=/tmp/$1.$$.html
      markdown "$1" | html2txt &gt; $fn  ### LOSES FORMATTING
      cat $fn                         ### TO STDOUT???
      ;;
    *)
    # We don't handle this format
    exit 1
  esac
  # No further processing by lesspipe necessary
  exit 0
  </code></pre>
  
  <p>So, the main questions are:</p>
  
  <ul>
  <li>How can I pass some basic formatting information to <code>less</code> as well, instead of losing it with <code>html2txt</code></li>
  <li>Is it correct to just print the new content to <em>stdout</em>? Or could I just write the <code>*.html</code> to file disk and let <code>less</code> handle that html at its own digression (seeing the html-extension and acting on it?)</li>
  </ul>