Making markdown work with Sublime Text 2

An awful journey, but almost there.

The goal was to use Sublime Text 2 as my markdown editor. Conveniently it has a feature that lets you preview your markdown in the browser. And it uses LiveReload so that when you change your markup and it's saved, the browser loads the newly rendered file.

Nice. In theory.

To start with, nothing works right in Linux unless you put this in your .bashrc file:

LANG=en_US.UTF-8

In practice there are a lot of problems. To start with, LiveReload spurts out a bunch of diagnostics that make it hard to see messages that might be printed in the python console. That's solved by editing livereload_s2.py in the LiveReload package file, and commenting out this line:

print("Encoded: %s" % repr(header + buf))
print data
 print response

Now the problem is that the pygments library is not loading.

I copied the library into the MarkdownPreview package directory, but get an error initializing.

oldmod = sys.modules['pygments.lexers']
newmod = _automodule('pygments.lexers')
newmod.__dict__.update(oldmod.__dict__)
sys.modules['pygments.lexers'] = newmod
del newmod.oldmod
del newmod.sys
del newmod.types
del newmod.newmod

with  
AttributeError: oldmod
on the line:
   del newmod.oldmod

I don't know how this works, so I'm going to give up for now.






Comments

Popular Posts