I'm using the Rainbow.js library to add syntax highlighting to LaTeX code like so:
Rainbow.extend('latex', [
{
'name': 'comment',
'pattern': /%.*$/gm
},
{
'name': 'storage.function',
'pattern': /\\[A-z@]+/g
},
{
'matches':
{
1: 'entity.name.function',
3: 'entity.class'
},
'pattern': /(\\(begin|end))\s*\{(.*?)\}/g
}
], true)
but it fails to highlight group #3
even though—by everything I see otherwise—the group is being captured. Any idea what may be going wrong? Why would it match the first group but not the third?