1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-01-26 03:20:10 +02:00

4 Commits

Author SHA1 Message Date
Gusted
4d11870090
Don't output extra whitespace in YAML multiline (#993)
This resolves a particular issue with parsing YAML multiline, for
example:
```yaml
a: |
  multiline literal
  line 2
```

The regex used would capture the amount of indentation in the third
capture group and then use that as a kind of "status" to know which
lines are part of the indented multiline. However, because its a
captured group it has to be assigned a token which was `TextWhitespace`.
This meant that the indentation was outputted after the multiline,
technically it should be seen as an non-captured group, but then its no
longer to refer to it in the regex. Therefore I've gone with the
solution to add a new token, Ignore, which will not be emitted as a
token in the iterator, which can safely be used to make use of capture
groups but not have them show up in the output.

## Before

![image](https://github.com/user-attachments/assets/c29353c5-9e15-4f14-a733-57a60fb51910)

## After

![image](https://github.com/user-attachments/assets/57b5d129-a9d3-4b84-ae1f-dc05182b9ad3)
2024-08-23 06:58:31 +10:00
Koki Fukuda
895a0488b5
Port Minecraft lexers from Pygments (#992)
Ported lexers for mcfuntion, snbt from Pygments using
`pygments2chroma_xml.py` script.

While doing so, I encountered lack of `LiteralNumberByte` in TokenType,
so I've added the type and regenerated tokentype_enumer.go.
2024-08-23 06:04:41 +10:00
Alec Thomas
4dd2cbef84 fix: bump to latest dclark/regexp2
Fixes #805
2023-09-09 11:46:52 +10:00
Alec Thomas
c263f6fa19
feat: XML style definitions (#693)
Fixes #635.
2022-11-01 21:23:14 -07:00