estienne

Crates.ioestienne
lib.rsestienne
version0.8.0-alpha
created_at2025-11-24 22:14:15.089719+00
updated_at2025-11-24 22:14:15.089719+00
descriptionEstienne is a library that scans plain text for Bible references and helps to format or link them to online Bibles, among other things.
homepage
repositoryhttps://github.com/JoelMon/Estienne
max_upload_size
id1948768
size59,912
Joel Montes de Oca (JoelMon)

documentation

README

Estienne

A digital image generated by an AI of a bearded man reading from a large book in the style of medieval painting.

Rust Crates.io License: MIT Project Status: WIP

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.

What Estienne Does

  • 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 Name

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

API at a glance

  • 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.

Status and roadmap

  • 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.

Installation

cargo add estienne

Examples

Highlight references inline

let 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."
);

Create markdown links to JW.org

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!["Read [Revelation 21:3-4](https://www.jw.org/en/library/bible/study-bible/books/revelation/21/#v66021003-v66021004) for comfort."]);

Extract scriptures as plain strings

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"]);

Get the locations of each scripture found in a string

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);

Contributing

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 0

cargo fmt