// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use std::borrow::Cow;
use lazy_static::lazy_static;
use regex::{Captures, Regex};
use crate::{cloze::expand_clozes_to_reveal_latex, media::files::sha1_of_data, text::strip_html};
lazy_static! {
static ref LATEX: Regex = Regex::new(
r#"(?xsi)
\[latex\](.+?)\[/latex\] # 1 - standard latex
|
\[\$\](.+?)\[/\$\] # 2 - inline math
|
\[\$\$\](.+?)\[/\$\$\] # 3 - math environment
"#
)
.unwrap();
static ref LATEX_NEWLINES: Regex = Regex::new(
r#"(?xi)
|