biofriction-wp-theme/node_modules/highlight.js/lib/languages/tex.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-10-26 14:18:09 +02:00
module.exports = function(hljs) {
var COMMAND1 = {
className: 'command',
begin: '\\\\[a-zA-Zа-яА-я]+[\\*]?'
};
var COMMAND2 = {
className: 'command',
begin: '\\\\[^a-zA-Zа-яА-я0-9]'
};
var SPECIAL = {
className: 'special',
begin: '[{}\\[\\]\\&#~]',
relevance: 0
};
return {
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
},
hljs.COMMENT(
'%',
'$',
{
relevance: 0
}
)
]
};
};