Estienne is a Rust library that scans plain text for Bible scriptures and helps you format or link them to online Bibles. It targets apps that work with notes, articles, and transcripts where scripture mentions appear in normal prose. No special markup is required for detecting and manipulating scriptures in text.
Estienne is early-stage software and the API can change. It already ships tested functions for formatting and linking verses and can be used.
- Detect Bible references in a string using a locale-aware parser.
- Wrap references with custom prefix and postfix text for styling.
- Turn references into markdown links that point to a specific online Bible (currently JW.org).
- Return the raw references or their index positions for custom processing.
The library is named after Robert Estienne, a French theologian of the early Christian era. He is best remembered for being the first to print the New Testament divided with numbered verses. Read More
surround(text, prefix, postfix) -> Result<String, BibleError>: wraps each detected reference.url(&Site, text) -> Result<String, BibleError>: inserts markdown links to the given site.get_scriptures(text) -> Result<Vec<String>, BibleError>: returns validated references.get_locations(text) -> Locations: returns reference start and end indexes plus the original string.
- Current focus: stability, better locale coverage, and richer parsing of ranged references.
- Short term: expand supported locales and improve error messages.
- Expect breaking changes until a stable release is tagged.
cargo add estiennelet text = "A popular scripture is John 3:16, it's quoted often.";
let highlighted = est::surround(text, "<strong>", "</strong>").unwrap();
assert_eq!(
highlighted,
"A popular scripture is <strong>John 3:16</strong>, it's quoted often."
);use est::locales::nwt_en::Site::JwOrg;
let text = "Read Revelation 21:3-4 for comfort.";
let linked = est::url(&JwOrg, text).unwrap();
assert_eq!(linked, vec for comfort."]);let text = "Cross reference Psalm 83:18 with Matthew 24:14.";
let refs = est::get_scriptures(text).unwrap();
assert_eq!(refs, vec!["Psalm 83:18", "Matthew 24:14"]);use est::{get_locations, Locations};
let text = "John 3:16 pairs well with 1 John 4:8.";
let locations: Locations = get_locations(text);
assert_eq!(locations.slices, vec![(0, 9), (24, 35)]);
assert_eq!(locations.string, text);Contributions are welcomed, but please be aware that the project is still in a very early phase and large portions of code might change at any moment. Feel free to open an issue if you have any questions, suggestions, or bug reports.
This project is licensed under the MIT License - see the LICENSE file for details.
