melpa/html/languages/tex.js
Donald Ephraim Curtis ed473afce2 Add styling to code on webpage.
Conflicts:

	html/style.css
2012-01-27 11:47:53 -06:00

62 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Language: TeX
Author: Vladimir Moskva <vladmos@gmail.com>
Website: http://fulc.ru/
*/
hljs.LANGUAGES.tex = function() {
var COMMAND1 = {
className: 'command',
begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?',
relevance: 10
};
var COMMAND2 = {
className: 'command',
begin: '\\\\[^a-zA-Zа-яА-я0-9]',
relevance: 0
};
var SPECIAL = {
className: 'special',
begin: '[{}\\[\\]\\&#~]',
relevance: 0
};
return {
defaultMode: {
contains: [
{ // parameter
begin: '\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
returnBegin: true,
contains: [
COMMAND1, COMMAND2,
{
className: 'number',
begin: ' *=', end: '-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?',
excludeBegin: true
}
],
relevance: 10
},
COMMAND1, COMMAND2,
SPECIAL,
{
className: 'formula',
begin: '\\$\\$', end: '\\$\\$',
contains: [COMMAND1, COMMAND2, SPECIAL],
relevance: 0
},
{
className: 'formula',
begin: '\\$', end: '\\$',
contains: [COMMAND1, COMMAND2, SPECIAL],
relevance: 0
},
{
className: 'comment',
begin: '%', end: '$',
relevance: 0
}
]
}
};
}();