1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-01-14 02:23:16 +02:00
Commit Graph

34 Commits

Author SHA1 Message Date
Alec Thomas
bdc1124369 Switch to Pygments-style CSS class names.
Add GitHub theme + CSS to style importer.
2017-09-25 21:46:25 +10:00
Alec Thomas
b0295f66bd Remove spurious newline in HTML output.
Fixes #29.
2017-09-25 15:25:32 +10:00
Alec Thomas
c984ca45c7 Add html.BaseLineNumber(n).
Fixes #22.
2017-09-24 20:33:50 +10:00
Alec Thomas
1af7e1a0bc Adjust line number padding a bit. 2017-09-23 22:45:05 +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
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
1724aab879 Implement compile-time lexer mutators.
This should fix #15.
2017-09-21 20:02:53 +10:00
Alec Thomas
551f7cee9a Return errors for invalid styles, rather than panicking. 2017-09-21 12:52:08 +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
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
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
d80c30ae4e Sort formatters and styles Names(). 2017-09-19 11:31:51 +10:00
Alec Thomas
c259129e64 Rename "raw" to "tokens", as it makes more sense. 2017-09-19 11:12:07 +10:00
Alec Thomas
fbc889aad6 Correct HTML output + add R/S.
Fixes #1, #2, #3.
2017-09-19 10:30:10 +10:00
Alec Thomas
c8636118d5 Remove unused dark/light style type. 2017-09-18 14:19:59 +10:00
Alec Thomas
1374cf9ffb More README. 2017-09-18 13:59:11 +10:00
Alec Thomas
431e913333 Update documentation. Include "quick" package. 2017-09-18 13:15:07 +10:00
Alec Thomas
86bda70acd Switch to github.com/dlclark/regexp2 2017-09-15 22:18:20 +10:00
Alec Thomas
d12529ae61 HTML formatter + import all Pygments styles. 2017-07-20 00:01:29 -07:00
Alec Thomas
a0db747409 Rename formatter "tokens" -> "raw". 2017-06-07 20:13:25 +10:00
Alec Thomas
7b6a07b9bb Revert to using CIE76 for style colour matching.
Some testing showed RGB distance was *really* bad.
2017-06-07 19:47:59 +10:00
Alec Thomas
d852022f8d Move style and formatter API into chroma package. 2017-06-07 19:47:59 +10:00
Alec Thomas
ef4a53333b Just use a basic RGB distance.
Not perfect, but probably sufficient.
2017-06-07 19:47:59 +10:00
Alec Thomas
5f7faa38d5 Add "tokens" formatter. 2017-06-07 19:47:59 +10:00
Alec Thomas
5749aebe42 Generalise and support 8, 256 and 16m colour terminals. 2017-06-07 19:47:59 +10:00
Alec Thomas
1f47bd705c Use pointers to tokens + support regex flags in importer. 2017-06-07 19:47:59 +10:00
Alec Thomas
5dedc6e45b Add a bunch of automatically translated lexers. 2017-06-07 19:47:59 +10:00
Alec Thomas
b30de35ff1 Use a callback to emit tokens.
This is a) faster and b) supports streaming output.
2017-06-07 19:47:59 +10:00
Alec Thomas
6dd81b044b Add Markdown processor. A bunch of performance improvements. 2017-06-07 19:47:59 +10:00
Alec Thomas
b2fb8edf77 Initial commit! Working! 2017-06-07 19:47:59 +10:00