mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-06-08 04:30:26 -03:00
Compare commits
8 Commits
c6824a99df
...
6766eb14f3
Author | SHA1 | Date | |
---|---|---|---|
6766eb14f3 | |||
3d3f9fcc24 | |||
61899cfe83 | |||
a583b7359e | |||
de2a4a1996 | |||
31334ac802 | |||
6d64491938 | |||
fb693bb221 |
35
.pre-commit-config.yaml
Normal file
35
.pre-commit-config.yaml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# 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.6.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.29.2
|
||||||
|
hooks:
|
||||||
|
- id: check-github-workflows
|
||||||
|
- repo: https://github.com/commitizen-tools/commitizen
|
||||||
|
rev: v3.29.0 # automatically updated by Commitizen
|
||||||
|
hooks:
|
||||||
|
- id: commitizen
|
||||||
|
- id: commitizen-branch
|
||||||
|
stages:
|
||||||
|
- post-commit
|
||||||
|
- push
|
18
CHANGELOG.md
Normal file
18
CHANGELOG.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [unreleased]
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Pre-commit hooks
|
||||||
|
- Git-cliff config
|
||||||
|
|
||||||
|
## [0.6.1] - 2024-08-25
|
||||||
|
|
||||||
|
### 📚 Documentation
|
||||||
|
|
||||||
|
- Improve readme and help message
|
||||||
|
|
||||||
|
<!-- generated by git-cliff -->
|
14
Makefile
14
Makefile
@ -1,3 +1,5 @@
|
|||||||
|
all: build
|
||||||
|
|
||||||
build: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
|
build: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
|
||||||
shards build -Dstrict_multi_assign -Dno_number_autocast -d --error-trace
|
shards build -Dstrict_multi_assign -Dno_number_autocast -d --error-trace
|
||||||
release: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
|
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
|
static: $(wildcard src/**/*.cr) $(wildcard lexers/*xml) $(wildcard styles/*xml) shard.yml
|
||||||
shards build --release --static
|
shards build --release --static
|
||||||
strip bin/tartrazine
|
strip bin/tartrazine
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf bin lib shard.lock
|
||||||
|
|
||||||
|
test:
|
||||||
|
crystal spec
|
||||||
|
|
||||||
|
lint:
|
||||||
|
ameba --fix src spec
|
||||||
|
|
||||||
|
.PHONY: clean all test bin lint
|
||||||
|
18
README.md
18
README.md
@ -6,15 +6,18 @@ 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.
|
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
|
Currently Tartrazine supports 247 languages and has 331 themes (63 from Chroma,
|
||||||
[Sixteen](https://github.com/ralsina/sixteen)
|
the rest are base16 themes via [Sixteen](https://github.com/ralsina/sixteen)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
If you are using Arch: Use yay or your favourite AUR helper, package name is `tartrazine`.
|
||||||
|
|
||||||
From prebuilt binaries:
|
From prebuilt binaries:
|
||||||
|
|
||||||
Each release provides statically-linked binaries that should
|
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:
|
To build from source:
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ To build from source:
|
|||||||
Show a syntax highlighted version of a C source file in your terminal:
|
Show a syntax highlighted version of a C source file in your terminal:
|
||||||
|
|
||||||
```shell
|
```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:
|
Generate a standalone HTML file from a C source file with the syntax highlighted:
|
||||||
@ -63,7 +66,7 @@ puts formatter.format(File.read(ARGV[0]), lexer)
|
|||||||
|
|
||||||
- [Roberto Alsina](https://github.com/ralsina) - creator and maintainer
|
- [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.
|
Pygments is a staple of the Python ecosystem, and it's great.
|
||||||
It lets you highlight code in many languages, and it has many
|
It lets you highlight code in many languages, and it has many
|
||||||
@ -86,5 +89,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
|
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)
|
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
|
Then performance was bad, so I hacked and hacked and made it significantly
|
||||||
significantly [faster than chroma](https://ralsina.me/weblog/posts/a-tale-of-optimization.html) which is fun.
|
[faster than chroma](https://ralsina.me/weblog/posts/a-tale-of-optimization.html)
|
||||||
|
which is fun.
|
||||||
|
79
cliff.toml
Normal file
79
cliff.toml
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# git-cliff ~ default configuration file
|
||||||
|
# https://git-cliff.org/docs/configuration
|
||||||
|
#
|
||||||
|
# Lines starting with "#" are comments.
|
||||||
|
# Configuration options are organized into tables and keys.
|
||||||
|
# See documentation for more information on available options.
|
||||||
|
|
||||||
|
[changelog]
|
||||||
|
# template for the changelog header
|
||||||
|
header = """
|
||||||
|
# Changelog\n
|
||||||
|
All notable changes to this project will be documented in this file.\n
|
||||||
|
"""
|
||||||
|
# template for the changelog body
|
||||||
|
# https://keats.github.io/tera/docs/#introduction
|
||||||
|
body = """
|
||||||
|
{% if version %}\
|
||||||
|
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||||
|
{% else %}\
|
||||||
|
## [unreleased]
|
||||||
|
{% endif %}\
|
||||||
|
{% for group, commits in commits | group_by(attribute="group") %}
|
||||||
|
### {{ group | striptags | trim | upper_first }}
|
||||||
|
{% for commit in commits %}
|
||||||
|
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
|
||||||
|
{% if commit.breaking %}[**breaking**] {% endif %}\
|
||||||
|
{{ commit.message | upper_first }}\
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}\n
|
||||||
|
"""
|
||||||
|
# template for the changelog footer
|
||||||
|
footer = """
|
||||||
|
<!-- generated by git-cliff -->
|
||||||
|
"""
|
||||||
|
# remove the leading and trailing s
|
||||||
|
trim = true
|
||||||
|
# postprocessors
|
||||||
|
postprocessors = [
|
||||||
|
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
|
||||||
|
]
|
||||||
|
|
||||||
|
[git]
|
||||||
|
# parse the commits based on https://www.conventionalcommits.org
|
||||||
|
conventional_commits = true
|
||||||
|
# filter out the commits that are not conventional
|
||||||
|
filter_unconventional = true
|
||||||
|
# process each line of a commit as an individual commit
|
||||||
|
split_commits = false
|
||||||
|
# regex for preprocessing the commit messages
|
||||||
|
commit_preprocessors = [
|
||||||
|
# Replace issue numbers
|
||||||
|
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
|
||||||
|
# Check spelling of the commit with https://github.com/crate-ci/typos
|
||||||
|
# If the spelling is incorrect, it will be automatically fixed.
|
||||||
|
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
|
||||||
|
]
|
||||||
|
# regex for parsing and grouping commits
|
||||||
|
commit_parsers = [
|
||||||
|
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
|
||||||
|
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
|
||||||
|
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
|
||||||
|
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
|
||||||
|
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
|
||||||
|
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
|
||||||
|
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
|
||||||
|
{ message = "^chore\\(release\\): prepare for", skip = true },
|
||||||
|
{ message = "^chore\\(deps.*\\)", skip = true },
|
||||||
|
{ message = "^chore\\(pr\\)", skip = true },
|
||||||
|
{ message = "^chore\\(pull\\)", skip = true },
|
||||||
|
{ message = "^chore|^ci", group = "<!-- 7 -->⚙️ Miscellaneous Tasks" },
|
||||||
|
{ body = ".*security", group = "<!-- 8 -->🛡️ Security" },
|
||||||
|
{ message = "^revert", group = "<!-- 9 -->◀️ Revert" },
|
||||||
|
]
|
||||||
|
# filter out the commits that are not matched by commit parsers
|
||||||
|
filter_commits = false
|
||||||
|
# sort the tags topologically
|
||||||
|
topo_order = false
|
||||||
|
# sort the commits inside sections by oldest/newest order
|
||||||
|
sort_commits = "oldest"
|
@ -127,4 +127,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -52,4 +52,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -63,4 +63,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -55,4 +55,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -75,4 +75,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -67,4 +67,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -19,4 +19,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -53,4 +53,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -31,4 +31,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -55,4 +55,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -73,4 +73,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -70,4 +70,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
@ -40,4 +40,3 @@
|
|||||||
</state>
|
</state>
|
||||||
</rules>
|
</rules>
|
||||||
</lexer>
|
</lexer>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user