chore: pre-commit hooks

This commit is contained in:
Roberto Alsina 2024-08-26 20:18:28 -03:00
parent c6824a99df
commit fb693bb221
289 changed files with 339 additions and 309 deletions

27
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,27 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: 3.0.0
hooks:
- id: shellcheck
- id: markdownlint
exclude: '^content'
- repo: https://github.com/mrtazz/checkmake
rev: 0.2.2
hooks:
- id: checkmake
exclude: lexers/makefile.xml
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.2
hooks:
- id: check-github-workflows

View File

@ -1,3 +1,5 @@
all: build
build: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
shards build -Dstrict_multi_assign -Dno_number_autocast -d --error-trace
release: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
@ -5,3 +7,15 @@ release: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml)
static: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
shards build --release --static
strip bin/tartrazine
clean:
rm -rf bin lib shard.lock
test:
crystal spec
lint:
ameba --fix src spec
.PHONY: clean all test bin lint

View File

@ -6,15 +6,16 @@ a port of [Pygments](https://pygments.org/) to
It also provides a CLI tool which can be used to highlight many things in many styles.
Currently Tartrazine supports 247 languages. and it has 331 themes (63 from Chroma, the rest are base16 themes via
[Sixteen](https://github.com/ralsina/sixteen)
Currently Tartrazine supports 247 languages and has 331 themes (63 from Chroma,
the rest are base16 themes via [Sixteen](https://github.com/ralsina/sixteen)
## Installation
From prebuilt binaries:
Each release provides statically-linked binaries that should
work on any Linux. Get them from the [releases page](https://github.com/ralsina/tartrazine/releases) and put them in your PATH.
work on any Linux. Get them from the [releases page](https://github.com/ralsina/tartrazine/releases)
and put them in your PATH.
To build from source:
@ -27,7 +28,7 @@ To build from source:
Show a syntax highlighted version of a C source file in your terminal:
```shell
$ tartrazine whatever.c -l c -t catppuccin-macchiato --line-numbers -f terminal
tartrazine whatever.c -l c -t catppuccin-macchiato --line-numbers -f terminal
```
Generate a standalone HTML file from a C source file with the syntax highlighted:
@ -63,7 +64,7 @@ puts formatter.format(File.read(ARGV[0]), lexer)
- [Roberto Alsina](https://github.com/ralsina) - creator and maintainer
## A port of what? Why "kind of"?
## A port of what, and why "kind of"
Pygments is a staple of the Python ecosystem, and it's great.
It lets you highlight code in many languages, and it has many
@ -86,5 +87,6 @@ This only covers the RegexLexers, which are the most common ones,
but it means the supported languages are a subset of Chroma's, which
is a subset of Pygments' and DelegatingLexers (useful for things like template languages)
Then performance was bad, so I hacked and hacked and made it
significantly [faster than chroma](https://ralsina.me/weblog/posts/a-tale-of-optimization.html) which is fun.
Then performance was bad, so I hacked and hacked and made it significantly
[faster than chroma](https://ralsina.me/weblog/posts/a-tale-of-optimization.html)
which is fun.

View File

@ -127,4 +127,3 @@
</state>
</rules>
</lexer>

View File

@ -52,4 +52,3 @@
</state>
</rules>
</lexer>

View File

@ -63,4 +63,3 @@
</state>
</rules>
</lexer>

View File

@ -55,4 +55,3 @@
</state>
</rules>
</lexer>

View File

@ -75,4 +75,3 @@
</state>
</rules>
</lexer>

View File

@ -67,4 +67,3 @@
</state>
</rules>
</lexer>

View File

@ -19,4 +19,3 @@
</state>
</rules>
</lexer>

View File

@ -53,4 +53,3 @@
</state>
</rules>
</lexer>

View File

@ -31,4 +31,3 @@
</state>
</rules>
</lexer>

View File

@ -55,4 +55,3 @@
</state>
</rules>
</lexer>

View File

@ -73,4 +73,3 @@
</state>
</rules>
</lexer>

View File

@ -70,4 +70,3 @@
</state>
</rules>
</lexer>

View File

@ -40,4 +40,3 @@
</state>
</rules>
</lexer>