Logged In: NO

I wrote a very minimal LaTeX syntax parser for codepress

in latex.js:
Language.syntax = [
// Comment %...
{ input : /\%(.*?)<br>/g, output : '<i>%$1</i><br>' },
// Mathmode \[...\]
{ input : /\\\[(.*?)\\\]/g, output : '\\\[<m>$1</m>\\\]' },
// Mathmode \(...\)
{ input : /\\\((.*?)\\\)/g, output : '\\\(<m>$1</m>\\\)' },
// Mathmode $...$
{ input : /([^\\])\$(.*?)([^\\])\$/g, output : '$1<b>\$</b><m>$2$3</m><b>\$</b>' },
// Command {\textrm ... }
{ input : /\\([a-zA-Z]+)/g, output : '<b>\\$1</b>'},
// Command \{, \^, etc
{ input : /\\([^0-9a-zA-Z&])/g, output : '<b>\\$1</b>'}, //command
// Command \& (special case of the above)
{ input : /\\\&(amp;)/g, output : '<b>\\\&</b>'}, // command
]

In latex.css:
b {color:red}
i {color:blue}
l {color:green}
m {color:cyan}
m b {color:green}

I only discovered Codepress yesterday so I doubt these will account for all LaTeX commands (the colors I picked also suck). Also, auto-complete won't work well since there are expressions like \{...\} and {...} in LaTeX. I hope this is a good start to better LaTeX support!

ldamewood@gmail.com