# tree-sitter-syncat-stylesheet

> Parser for Syncat stylesheets

Latest version **2.2.1** (published 2021-07-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install tree-sitter-syncat-stylesheet
pnpm add tree-sitter-syncat-stylesheet
yarn add tree-sitter-syncat-stylesheet
bun add tree-sitter-syncat-stylesheet
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2021-07-15 |
| First published | 2019-04-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 88.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 69 |
| Author | Cameron Eldridge |
| Maintainers | foxfriends |

## Links

- npm: https://www.npmjs.com/package/tree-sitter-syncat-stylesheet
- Repository: https://github.com/foxfriends/syncat
- Homepage: https://github.com/foxfriends/syncat#readme
- Issues: https://github.com/foxfriends/syncat/issues
- npm.io page: https://npm.io/package/tree-sitter-syncat-stylesheet

## Dependencies (1)

- [nan](https://npm.io/package/nan.md) ^2.14.0

## Recent versions

- 2.2.1 (latest) — 2021-07-15
- 2.2.0 — 2020-03-14
- 2.1.1 — 2020-02-19
- 2.1.0 — 2020-02-19
- 2.0.0 — 2020-02-18
- 1.1.1 — 2019-10-07
- 1.1.0 — 2019-04-24
- 1.0.1 — 2019-04-08
- 1.0.0 — 2019-04-08

## README

[Tree-sitter]: https://github.com/tree-sitter/tree-sitter
[syncat-themes]: https://github.com/foxfriends/syncat-themes
[languages.toml]: https://github.com/foxfriends/config/blob/syncat/languages.toml
[crates.io]: https://crates.io
[Bat]: https://github.com/sharkdp/bat
[`syncat/config`]: ./syncat/config

# Syncat

Syntax aware cat utility. Provides syntax highlighting to files printed on the command line using
[Tree-sitter][] to parse the files, and ANSI escape codes to colour them.

## Features

Syncat aims to provide similar features to the standard `cat` and the similar [Bat][] tool:
1.  Git integration (`-g`)
2.  Show line endings (`-e`)
3.  Line numbering (`-n`)
4.  Multiple levels of framing (`-f` or `-ff`)
5.  File concatenation
6.  Parses any file type accurately using Tree-sitter
7.  Customizable syntax colouring using stylesheets

In particular, the advantage of Syncat over the other options is that the parsing is done using
[Tree-sitter][] instead of with regular expressions, which makes it
* very fast;
* robust enough to provide useful results even in the presence of syntax errors.

Syncat does not support automatic paging, but you can just use `less -r` to handle that.

## Installation

Syncat can be installed from [crates.io][]:

```bash
cargo install syncat
```

## Configuration

By default, Syncat comes bundled with the configuration files as seen in [`syncat/config`][],
providing an unverified list of tree-sitter grammars, and some quickly cobbled together
highlighting for a handful of known file types.

If this basic configuration does not suffice, you may choose to configure Syncat yourself.
Do so by copying the [`syncat/config`][] folder and modifying them. You may also be interested
in instead copying my personal configuration of Syncat, which can be found in the [syncat-themes][]
repository.

In either case, copy (or create new) those files in the appropriate configuration directory, depending on
your operating system, and then continuing to the following sections. The appropriate directories are:
*   Linux: `$HOME/.config/syncat/` (more accurately, `$XDG_CONFIG_HOME/syncat`)
*   Mac: `$HOME/Library/Preferences/com.cameldridge.syncat/`
*   Windows: Not officially supported

### Stylesheets

The official stylesheets (admittedly somewhat incomplete) are available [here][syncat-themes].

Stylesheets are placed in the configuration directory, under a subdirectory `style`. You can
get the official themes as below, or just create this directory yourself.

```bash
cd ~/.config/syncat # or `cd ~/Library/Preferences/com.cameldridge.syncat` for Mac users
git clone https://github.com/foxfriends/syncat-themes style
```

For full documentation on how these stylesheet customizations work, see the README in
the [syncat-themes][] repository.

### Languages

As Syncat uses Tree-sitter for parsing, you must download and compile Tree-sitter parsers for
Syncat to use. Fortunately, the downloading and compiling can be handled by Syncat, given you
specify what to download.

The language map is a simple TOML file named `languages.toml`, located in the root of the
configuration folder. A good start might be to try [mine][languages.toml].

Each entry in this file describes one language, and is a table of 4
or 5 keys. The example entry below would install a highlighter for Syncat stylesheets.

```toml
[syncat-stylesheet] # The name here is arbitrary
# The URL of the Git repository where the language is defined
source = "https://github.com/foxfriends/syncat"
# Optional: The path within the repository to the tree-sitter package.
# Leave this out if the language is defined in the root of the repository.
path = "tree-sitter-syncat-stylesheet"
# The name of the directory to clone the `source` repository into. Typically
# this is the same name as the source repository, but you must specify it anyway.
library = "syncat"
# The name of this language. This value should be the same as the value listed
# in the `grammar.js` file from the repository.
#
# This name will also be the name of the stylesheet file used when highlighting
# this language.
name = "syncat_stylesheet"
# A list of file extensions which should be parsed using this language.
extensions = ["syncat"]
```

Once you have filled this file to your liking, the command `syncat install` will install all
of those languages. Running `syncat install` again later will update all languages, and install
any new ones.

## Usage

```bash
# Colours this file based on the extension
syncat src/main.rs

# Uses the shell expansion, colouring each file by its own extension
syncat src/*.rs

# Colours the file using a specific language
syncat -l js src/package.json

# Exports the default configuration into your system's configuration directory
syncat init

# Installs (or updates) all languages listed in the `languages.toml` file
syncat install

# Installs only a specific entry in the `languages.toml` file
syncat install rust

# Uninstalls a language. A few points to note:
# *   The language must still be listed in the `languages.toml` file.
# *   This does not remove the file from `languages.toml`, only deletes its installation.
syncat remove rust

# Show information about all languages listed in `languages.toml`
syncat list
```

---
_Source: https://npm.io/package/tree-sitter-syncat-stylesheet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
