1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-01-28 03:29:41 +02:00

92 Commits

Author SHA1 Message Date
Alec Thomas
b0295f66bd Remove spurious newline in HTML output.
Fixes #29.
2017-09-25 15:25:32 +10:00
Alec Thomas
022592be12 Correctly prioritise names over aliases. 2017-09-25 11:56:25 +10:00
Alec Thomas
cf0d471c44 Merge pull request #26 from glaforge/patch-1
Missing 'as' and 'in' keywords for Groovy
2017-09-24 23:22:00 +10:00
Guillaume Laforge
cce6c8e193 Missing 'as' and 'in' keywords 2017-09-24 14:45:24 +02:00
Alec Thomas
b83a015e0b More YAML tweaks. 2017-09-24 21:57:29 +10:00
Alec Thomas
b25b614cb6 Remove comment. 2017-09-24 21:47:46 +10:00
Alec Thomas
237eebbe1a A naive YAML lexer.
Does not try to be smart in anyway. Instead, just highlights what it
can. Used this reference: https://learnxinyminutes.com/docs/yaml/

Fixes #13.
2017-09-24 21:47:05 +10:00
Alec Thomas
c984ca45c7 Add html.BaseLineNumber(n).
Fixes #22.
2017-09-24 20:33:50 +10:00
Alec Thomas
d1be6303e6 Merge pull request #25 from steambap/master
Add GDScript lexer
2017-09-24 19:30:07 +10:00
Weilin Shi
cff81ff391 Add GDScript lexer 2017-09-24 12:58:23 +08:00
Alec Thomas
0e1d1c1e77 Merge pull request #24 from rogersachan/patch-1
Remove old license
2017-09-24 09:09:45 +10:00
Roger
b3b9d8dc51 Remove old license 2017-09-23 19:04:18 -04:00
Alec Thomas
1af7e1a0bc Adjust line number padding a bit. 2017-09-23 22:45:05 +10:00
Alec Thomas
99d0e4924a Simplify command-line flags a bit. 2017-09-23 22:29:46 +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
8170d52c25 Remove dependency on go-colorful.
Switched to a less accurate (but much simpler) colour distance function
as described here: https://www.compuphase.com/cmetric.htm

Fixes #17.
2017-09-22 23:00:03 +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
f8658edb57 Add Restructured Text lexer. 2017-09-22 22:29:17 +10:00
Alec Thomas
e5fd873611 Merge pull request #20 from sago35/fix-windows-color
Fix colors on windows
2017-09-22 21:12:12 +10:00
sago35
1364bff44a Fix colors on windows 2017-09-22 19:33:23 +09:00
Alec Thomas
c279acf57e Merge pull request #19 from steambap/master
Fix JavaScript keywords
2017-09-22 11:03:19 +10:00
Weilin Shi
698bea1f19 Fix JavaScript keywords 2017-09-22 09:00:51 +08: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
e5e7b57c46 Fix style tests. 2017-09-21 12:54:18 +10:00
Alec Thomas
551f7cee9a Return errors for invalid styles, rather than panicking. 2017-09-21 12:52:08 +10:00
Alec Thomas
e59d4639fc Add async/await to JS lexer. Fixes #12. 2017-09-21 12:36:22 +10:00
Alec Thomas
4c6dba0fc4 Add "monokailight" style. 2017-09-21 12:28:03 +10:00
Alec Thomas
fd4772d9fc Merge pull request #11 from azillion/patch-1
Add missing letter
2017-09-21 08:26:44 +10:00
alexander zillion
1b9f70d081 Add missing letter 2017-09-20 16:00:44 -05: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
3f941ddff4 Correctly add styles for line numbers and line highlights when inling.
Fixes #7. Fixes #9.
2017-09-20 20:32:15 +10:00
Alec Thomas
44b23f97b4 Split Regexp lexer into its own file. 2017-09-20 20:19:33 +10:00
Alec Thomas
a5637e60b2 Support for highlighting ranges of lines. 2017-09-20 14:24:49 +10:00
Alec Thomas
3f230ec717 Add support for line numbers. 2017-09-20 13:33:44 +10:00
Alec Thomas
feb78ed6f3 Combine HTML formatting functions. 2017-09-19 23:04:10 +10:00
Alec Thomas
b57f8a4b4b Update list. 2017-09-19 14:37:00 +10:00
Alec Thomas
2b1ffff691 Add missing Genshi variants. 2017-09-19 14:32:01 +10:00
Alec Thomas
a72960340e Add test to pre-compile all regexes. 2017-09-19 14:15:33 +10:00
Alec Thomas
87183b3633 Add HTML formatter option for setting the tab width. 2017-09-19 13:14:29 +10:00
Alec Thomas
631fc87d6e Fix lua lexer, and actually check error value from compiling regexes :( 2017-09-19 12:05:53 +10:00
Alec Thomas
00d5486e6b Add lexers.MatchMimeType(mimeType). 2017-09-19 11:52:23 +10:00
Alec Thomas
d80c30ae4e Sort formatters and styles Names(). 2017-09-19 11:31:51 +10:00
Alec Thomas
04782e0678 Add doc.go. 2017-09-19 11:20:43 +10:00
Alec Thomas
c259129e64 Rename "raw" to "tokens", as it makes more sense. 2017-09-19 11:12:07 +10:00