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

65 Commits

Author SHA1 Message Date
Alec Thomas
cc53faa932 Add option to preserve all HTML classes.
Fixes #346.
2020-04-13 07:36:37 +10:00
Alec Thomas
bac74c1016 Fix Makefile. 2020-01-02 21:50:01 +11:00
Alec Thomas
9fb54c5f75 Add separate go module for ./cmd/chromad.
Fixes #261.
2019-11-28 11:40:24 +11:00
Alec Thomas
2d34ebacdb Simplify configuration of HTML call. 2019-11-28 11:21:12 +11:00
Bjørn Erik Pedersen
5921c52787 Add bool argument to WithClasses, WithLineNumbers etc.
This allows the boolean options to be reconfigured, e.g:

```go
options := getOptions()
options = append(options, html.WithLineNumbers(true))
```

Fixes #301
2019-11-22 10:13:00 +11:00
Alec Thomas
73d11b3c45 Clear background colour for TTY formatters. 2019-10-15 21:08:17 +11:00
rsteube
22511fb8e4 added svg formatter
basic version without any options. colors and font-styles seem to be ok.
rough support for text background in styles like `murphy` using predrawn
rectangles (svg has no text background attribute).

things to improve:
- svg width attribute (`<svg width=""`)
- linenumbers
- highlighting
- embedded font
- tabwidth option
- margins?
- better position/width calculation (rectangles not correctly drawn on
resize)
2019-09-30 09:43:27 +10:00
Alec Thomas
bbbfbe4e7a Update to more recent golangci-lint. 2019-07-19 18:57:05 +10:00
Alec Thomas
2ec7e6c2d1 Use Kong enum for lexers, formatters and styles. 2019-07-19 16:29:13 +10:00
Alec Thomas
3411213e25 Temporarily use go.rice fork with correct asset timestamping/versioning. 2019-07-17 11:24:40 +10:00
Alec Thomas
9fbb21283d Render full HTML. 2019-07-16 23:24:37 +10:00
Alec Thomas
89e7ddc5d9 Disable spellchecking/autocomplete. 2019-07-16 22:22:30 +10:00
Alec Thomas
5da2819c7d Add cache-busting version. 2019-07-16 22:19:43 +10:00
Alec Thomas
c86a26959c Add info block. 2019-07-16 22:08:09 +10:00
Alec Thomas
aa71d61cc0 Only allow POST to /api/render. 2019-07-16 21:47:36 +10:00
Alec Thomas
ffa8a4f67f CORS support + raw HTML view + more. 2019-07-16 21:31:37 +10:00
Alec Thomas
bdb587cd37 Make playground completely dynamic. 2019-07-16 18:45:54 +10:00
Alec Thomas
2332264124 Add CSRF support to chromad. 2019-07-16 16:17:37 +10:00
Alec Thomas
7a7fde259b Split out chromad resources. 2019-07-16 15:45:06 +10:00
Alec Thomas
91b44ffd76 Lint isses. 2019-07-16 14:26:56 +10:00
Alec Thomas
10cee2ee79 Add Chroma playground.
Found here: https://swapoff.org/chroma/playground
2019-07-16 14:19:54 +10:00
Alec Thomas
da5ac60d8c Add golangci-lint and fix all lint issues. 2018-12-31 22:46:59 +11:00
Alec Thomas
3b3f74c6a5 Fix stdin mode in chroma tool.
Fixes #207.
2018-12-14 10:42:19 +11:00
Alec Thomas
3175fa52d7 Support go modules + VB.Net lexer.
Fixes #201.
2018-12-03 20:38:33 -10:00
Daniel Eloff
9c3abeae1d Tokens by value (#187)
This results in about a 8% improvement in speed.
2018-11-04 10:22:51 +11:00
Felix Knischewski
e36baa268a Add option to prevent surroundign pre tags 2018-09-18 19:44:44 +10:00
Alec Thomas
222a1f0fc8 Don't require --html to write styles.
See #139.
2018-04-21 09:30:33 +10:00
Alec Thomas
e56590a815 Add data-driven test framework for lexers.
See #68.
2018-01-02 14:53:25 +11:00
Douglas La Rocca
3d8ce90892 Select lexer with --filename argument (#77)
cgit's syntax highlighting filter pipes to STDIN and provides the
filename in argv; the analyzer often fails but we have access to the
original filename, so we add an optional argument to specify the
filename to use for matching a lexer when reading from STDIN; when
[files...] are provided to chroma this is completely ignored
2017-10-24 12:23:43 +11:00
Trevor Joynson
ac34ab1937 Remove binary file and add to gitignore (#72) 2017-10-23 10:50:14 +11:00
Bjørn Erik Pedersen
27733ac753 Add table styled line numbers (#54)
Fixes #52
2017-10-13 10:49:20 +11:00
Kenneth Shaw
edf15b0aff Fix order output of chroma cli tool
Changes output for the chroma cli tool for styles and formatters so that
the output on --list is always in the same order.
2017-10-10 03:39:58 +07:00
Orivej Desh
feb2cdccf3 Add --check flag to aid in lexer development 2017-10-03 12:03:25 +00:00
Alec Thomas
2181aa5f70 Fix goreleaser config (hopefully). 2017-09-25 18:15:44 +10:00
Alec Thomas
c984ca45c7 Add html.BaseLineNumber(n).
Fixes #22.
2017-09-24 20:33:50 +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
sago35
1364bff44a Fix colors on windows 2017-09-22 19:33:23 +09:00
Alec Thomas
60797cc03f Add tracing + better error recovery. 2017-09-21 17:52:28 +10:00
Alec Thomas
551f7cee9a Return errors for invalid styles, rather than panicking. 2017-09-21 12:52:08 +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
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
87183b3633 Add HTML formatter option for setting the tab width. 2017-09-19 13:14:29 +10:00
Alec Thomas
00d5486e6b Add lexers.MatchMimeType(mimeType). 2017-09-19 11:52:23 +10:00
Alec Thomas
3df4c80190 Rename S -> R + sort list of lexers. 2017-09-19 10:47:22 +10:00
Alec Thomas
fbc889aad6 Correct HTML output + add R/S.
Fixes #1, #2, #3.
2017-09-19 10:30:10 +10:00
Yasuhiro Matsumoto
686fad4ef4 support windows colors 2017-09-19 00:27:47 +09:00
Alec Thomas
1374cf9ffb More README. 2017-09-18 13:59:11 +10:00