Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frozolotl/typst-ansi-hl
typst-ansi-hl highlights your Typst code
https://github.com/frozolotl/typst-ansi-hl
ansi cli discord tools typst
Last synced: about 2 months ago
JSON representation
typst-ansi-hl highlights your Typst code
- Host: GitHub
- URL: https://github.com/frozolotl/typst-ansi-hl
- Owner: frozolotl
- License: eupl-1.2
- Created: 2024-01-28T20:42:16.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-10-18T23:23:34.000Z (2 months ago)
- Last Synced: 2024-10-19T02:41:51.154Z (2 months ago)
- Topics: ansi, cli, discord, tools, typst
- Language: Rust
- Homepage:
- Size: 168 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typst-ansi-hl
typst-ansi-hl highlights your Typst code using ANSI escape sequences.It is especially intended to be used to provide the otherwise missing Typst syntax highlighting in Discord.
## Installation
```sh
cargo install --path .
```## Usage
Simply run `typst-ansi-hl main.typ` or pipe the source code into `typst-ansi-hl`.
See [Clipboard-based Workflow](#clipboard-based-workflow) for information on how to copy Discord-compatible output to your clipboard.```
Usage: typst-ansi-hl [OPTIONS] [INPUT]Arguments:
[INPUT]
The input path. If unset, stdin is usedOptions:
-d, --discord
Wrap the output in a Discord-flavoured-markdown–style ANSI codeblock-D, --no-discord
Don't wrap the output in a markdown-style codeblock. [default]-s, --strip-ansi
Strip all ANSI escape sequences from the input before processing. [default]-S, --no-strip-ansi
Don't remove escape sequences from the input-c, --unwrap-codeblock
If the input is surrounded by an ANSI codeblock as generated by this tool, remove it-C, --no-unwrap-codeblock
Don't remove surrounding codeblock from the input. [default]-u, --unindent
Strip any top-level indentation in the input prior to highlighting it-U, --no-unindent
Keep indents as-is. [default]-l, --soft-limit
Softly enforce a byte size limit.This means that if the size limit is exceeded, less colors are used in order to get below that size limit. If it is not possible to get below that limit, the text is printed anyway.
-m, --mode
The kind of input syntax[default: markup]
[possible values: code, markup, math]-h, --help
Print help (see a summary with '-h')
```### Clipboard-based Workflow
You can bind one of the following commands to a certain key bind for improved ease-of-use:
```sh
# Linux X11 (Bash/Zsh/Fish/Nushell)
xclip -selection clipboard -out | typst-ansi-hl --discord --soft-limit 2000 | xclip -selection clipboard -in# Linux Wayland (Bash/Zsh/Fish/Nushell)
wl-paste | typst-ansi-hl --discord --soft-limit 2000 | wl-copy --type text/markdown# Windows (PowerShell)
Get-Clipboard | typst-ansi-hl --discord --soft-limit 2000 | Set-Clipboard
```### Library
You can also use this crate as a library.
See the [documentation](https://docs.rs/typst-ansi-hl/latest) for further details.## Legal
This software is not affiliated with Typst, the brand.