asciimath-unicode 0.4.1

Convert asciimath to unicode
Documentation

Asciimath Unicode

crates.io docs license tests

Render asciimath to unicode.

To convert asciimath quickly, you can use parse_unicode to get an Asciimath value that implements Display. If you want more control, see the options exposed through Conf which can parse input into Asciimath as well.

Usage

Binary

This crate provides a simple cli for converting asciimath to unicode:

cargo install asciimath-unicode --features binary
asciimath-unicode -h

Library

cargo add asciimath-unicode
let res = asciimath_unicode::parse_unicode("1/2").to_string();
assert_eq!(res, "½");
use asciimath_unicode::Conf;
let conf = Conf {
    vulgar_fracs: false,
    ..Default::default()
};
let res = conf.parse("1/2").to_string();
assert_eq!(res, "¹⁄₂");
use asciimath_unicode::Conf;
let conf = Conf {
    block: true,
    ..Default::default()
};
let res = conf.parse("x/y").to_string();
assert_eq!(res, "x\n\ny");

Configuration

Field Type Default Description
strip_brackets bool true Strip unnecessary parentheses in some contexts
vulgar_fracs bool true Render fractions as vulgar fractions (e.g. ½)
script_fracs bool true Render fractions using super/subscripts (e.g. ¹⁄₂)
skin_tone SkinTone Default Default skin tone for emojis
block bool false Multi-line 2D block rendering (stacked fractions, vertical scripts, matrix grids)