A simple crate that provides functions to map a greek letter, latin letter, or a decimal digit to a certain variant from the mathematical alphanumeric symbols Unicode block (U+1D400âU+1D7FF). We also provide convenience string methods that maps each character in a string to the variant (or leaves it alone if there is none).
Supported variants are:
Add this to your Cargo.toml
:
toml
[dependencies]
math-text-transform = "*"
```rust extern crate mathtexttransform; use mathtexttransform::MathTextTransform;
asserteq!("Bold".tomathbold(), "đđ¨đĨđ"); asserteq!("ÎŖÎąÎŊĪ-ÎŖÎĩĪΚĪ-ÎÎŋÎģδ".tomathsansserifbold(), "đ¨đ°đŧđ-đ¨đ´đđ¸đ -đđžđēđŗ"); asserteq!("Double-struck 123".tomathdoublestruck(), "đģđ đĻđđđ-đ¤đĨđŖđĻđđ đđđ"); ```
https://runarberg.github.com/math-text-transform
If you are for some reason only interested in the CLI utility you can install with:
bash
$ git clone https://github.com/runarberg/math-text-transform.git
$ cd math-text-transform
$ cargo build --release
$ [sudo] ln -s $(pwd)/target/release/math-text-transform /usr/local/bin/math-text-transform
And use like so:
bash
math-text-transform <variant> <text>
Text can also be supplied through the standard input.
bash
$ math-text-transform -bf-it Bold-Italic
đŠđđđ
-đ°đđđđđ
$ echo "Double struck" | math-text-transform --double-struck
đģđ đĻđđđ đ¤đĨđŖđĻđđ