- Rust 100%
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE.txt | ||
| README.md | ||
Inline Styles for Gemtext
Renders Markdown-like inline styling marks with ANSI escape sequences. Does not change headers, links, quotation lines or pre_formatted blocks.
Uses best-effort heuristics. If it breaks you get to keep the pieces.
Installation
If there is a pre-built binary for your platform under releases, download and use it.
Otherwise, if you have Rust toolchain installed, build with cargo build --release. The
binary will be under target/release/ directory. Either use it from there, or
copy it to somewhere in your $PATH.
$ gemtext-inline-styler -h
Lagrange mimehook filter for gemtext inline styles
Usage: gemtext-inline-styler [OPTIONS] [MIME]...
Arguments:
[MIME]... MIME type and parameters
Options:
-a, --asterisk <SGR> SGR code for *asterisk* [default: 3]
-A, --no-asterisk Do not handle *asterisk*
-d, --double-asterisk <SGR> SGR code for **double asterisk** [default: 1]
-D, --no-double-asterisk Do not handle **double asterisk**
-u, --underscore <SGR> SGR code for _underscore_ [default: 3]
-U, --no-underscore Do not handle _underscore_
-b, --backtick <SGR> SGR code for `backtick` [default: ""]
-B, --no-backtick Do not handle `backtick`
-F, --no-alternate-font Do not use monospace font for backtick
-s, --show-marks Do not hide the styling marks
-i, --ignore-pattern <REGEX> Do not process if `$REQUEST_URL` matches REGEX
-h, --help Print help (see more with '--help')
-V, --version Print version
Test it in your terminal to see its output for your inputs:
$ gemtext-inline-styler -b "30;92" -F -u 4 text/gemini
You need to enable “Gemtext ANSI escapes” from Lagrange content preferences.
Then register it with Lagrange by adding a mimehooks.txt under Lagrange
configuration directory. For example:
Renders inline styling
text/gemini
/path/to/gemtext-inline-styler;-b30,92;-s
Lagrange expects arguments to be separated with ;.
For the SGR codes, you can use , instead of ; if it contains ;.
Note that mime hooks in Lagrange also change the page source.
License
Licensed under the GNU APGL version 3 (or later). See the LICENSE.txt file for details.