1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-21 19:06:18 +02:00

17 Commits

Author SHA1 Message Date
Kenneth Shaw
95d0a9381b Fix Dollar-Quoted Strings (postgres + cql)
This commit refactors code from the markdown lexer into the chroma
package, and alters the PostgreSQL and CQL lexers to make use of it.

Additionally, an example markdown with the various sublexers is added.
2018-06-12 09:16:18 +07:00
Alec Thomas
f315512f5c Add support for Go templates.
These are exposed as go-text-template and go-html-template.

Fixes #105.
2018-03-18 21:57:34 +11:00
Alec Thomas
3020e2ea8c Fix bug with nested newlines.
Fixes #124.

Also reinstitute lexer tests that disappeared during package split.
2018-03-03 10:16:21 +11:00
Alec Thomas
35126f9a94 Implement rudimentary JSX lexer based on https://github.com/fcurella/jsx-lexer/blob/master/jsx/lexer.py
Fixes #111.
2018-02-07 22:11:40 +11:00
Alec Thomas
ce3d6bf527 Invert default "ensure newline" behaviour so that it is opt-in.
See #47.
2017-09-30 14:41:05 +10:00
Alec Thomas
573c1d157d Ensure a newline exists at the end of files.
Fixes #42.
2017-09-29 21:59:52 +10:00
Alec Thomas
d5083b3f7c Big changes to the style and colour APIs.
- Styles now use a builder system, to enforce immutability of styles.
- Corrected and cleaned up how style inheritance works.
- Added a brightening function to colours
- HTML formatter will now automatically pick line and highlight colours
  if they are not provided in the style. This is done by slightly
  darkening or lightening.

Fixes #21.
2017-09-23 22:09:46 +10:00
Alec Thomas
9d7539a4cd Fix bug in Turtle lexer. 2017-09-22 23:27:40 +10:00
Alec Thomas
a5a3b67010 Reprocess all rules after a LexerMutator is applied. 2017-09-22 23:14:32 +10:00
Alec Thomas
2ce2ec7f65 Fix bug with empty states. 2017-09-22 22:40:00 +10:00
Alec Thomas
0bb853fb4f Convert Include to a LexerMutator.
Fixes #18.
2017-09-22 22:29:17 +10:00
Alec Thomas
1724aab879 Implement compile-time lexer mutators.
This should fix #15.
2017-09-21 20:02:53 +10:00
Alec Thomas
60797cc03f Add tracing + better error recovery. 2017-09-21 17:52:28 +10:00
Alec Thomas
e2d6abaa64 Document and add iterator panic recovery. 2017-09-20 23:06:23 +10:00
Alec Thomas
cc0e4a59ab Switch to an Iterator interface.
This is to solve an issue where writers returned by the Formatter
were often stateful, but this fact was not obvious to the API consumer,
and failed in interesting ways.
2017-09-20 22:19:36 +10:00
Alec Thomas
36ead7258a Use utf8.RuneCountInString() rather than len() :(
Fixes #10. Thanks @curio77.
2017-09-20 20:36:25 +10:00
Alec Thomas
44b23f97b4 Split Regexp lexer into its own file. 2017-09-20 20:19:33 +10:00