| Crates.io | penmanship |
| lib.rs | penmanship |
| version | 0.1.0 |
| created_at | 2025-10-31 19:11:49.833707+00 |
| updated_at | 2025-10-31 19:11:49.833707+00 |
| description | A Unicode character lookup library for converting text patterns to Unicode characters |
| homepage | |
| repository | https://github.com/theroyalwhee0/penmanship |
| max_upload_size | |
| id | 1910600 |
| size | 318,513 |
A Rust library for Unicode character lookup via text patterns. Convert text aliases like "...", "alpha", "(c)" to their corresponding Unicode characters (…, α, ©).
no_std compatible: Works in embedded and bare-metal environmentsphfAdd penmanship to your Cargo.toml:
[dependencies]
penmanship = "0.1"
Basic usage:
use penmanship::lookup;
fn main() {
// Look up Unicode characters by pattern
if let Some((character, description)) = lookup("...") {
println!("{} - {}", character, description);
// Output: … - horizontal ellipsis
}
if let Some((character, _)) = lookup("alpha") {
println!("{}", character); // Output: α
}
if let Some((character, _)) = lookup("(c)") {
println!("{}", character); // Output: ©
}
// Unknown patterns return None
assert_eq!(lookup("unknown"), None);
}
All categories are enabled by default via the full feature. Examples:
// Punctuation
lookup("...") // … - horizontal ellipsis
lookup("em") // — - em dash
lookup("'l") // ' - left single quotation mark
// Math
lookup("!=") // ≠ - not equal to
lookup("->") // → - rightwards arrow
lookup("infinity") // ∞ - infinity
// Greek letters (case-sensitive)
lookup("alpha") // α - greek small letter alpha
lookup("Alpha") // Α - greek capital letter alpha
// Fractions
lookup("1/2") // ½ - fraction one half
// Currency
lookup("euro") // € - euro sign
// Symbols
lookup("(c)") // © - copyright sign
lookup("deg") // ° - degree sign
// Superscripts & Subscripts
lookup("^2") // ² - superscript two
lookup("_2") // ₂ - subscript two
// HTML entities (2200+ supported)
lookup(" ") // (non-breaking space)
lookup("<") // < - less than
// Emoji (1800+ shortcodes)
lookup(":smile:") // 😄 - grinning face with smiling eyes
lookup(":heart:") // ❤️ - red heart
For a complete list of all supported patterns, see docs/mappings.md.
By default, all categories are enabled via the full feature. To use only specific categories:
[dependencies]
penmanship = { version = "0.1", default-features = false, features = ["punctuation", "math", "greek"] }
Available features:
full (default) - All categoriespunctuation - Punctuation and typographymath - Mathematical operators and symbolsgreek - Greek lettersfractions - Fraction characterscurrency - Currency symbolssymbols - Miscellaneous symbolssuperscripts - Superscript characterssubscripts - Subscript charactershtml - HTML named character referencesemoji - Emoji shortcode lookup (requires emojis crate)no_std compatible: No standard library required, works in embedded environments.gitignoreContributions are welcome! See CONTRIBUTING.md for guidelines.
For security vulnerabilities and reporting guidelines, see SECURITY.md.
emojis crateCopyright © 2025 Adam Mill
Licensed under the Apache License, Version 2.0. See LICENSE.txt for details.