diff --git a/crates/typst-library/src/math/equation.rs b/crates/typst-library/src/math/equation.rs index db5253834..74550d210 100644 --- a/crates/typst-library/src/math/equation.rs +++ b/crates/typst-library/src/math/equation.rs @@ -1,6 +1,7 @@ use std::num::NonZeroUsize; use codex::styling::MathVariant; +use ecow::EcoString; use typst_utils::NonZeroExt; use unicode_math_class::MathClass; @@ -47,6 +48,9 @@ use crate::text::{FontFamily, FontList, FontWeight, LocalName, TextElem}; /// [main math page]($category/math). #[elem(Locatable, Synthesize, ShowSet, Count, LocalName, Refable, Outlinable)] pub struct EquationElem { + /// An alternative description of the mathematical equation. + pub alt: Option, + /// Whether the equation is displayed as a separate block. #[default(false)] pub block: bool, diff --git a/crates/typst-library/src/model/link.rs b/crates/typst-library/src/model/link.rs index 5d40a306e..6e7539059 100644 --- a/crates/typst-library/src/model/link.rs +++ b/crates/typst-library/src/model/link.rs @@ -88,7 +88,7 @@ use crate::text::{LocalName, TextElem}; /// generated. #[elem(Locatable)] pub struct LinkElem { - /// A text describing the link. + /// An alternative description of the link. pub alt: Option, /// The destination the link points to. diff --git a/crates/typst-library/src/visualize/image/mod.rs b/crates/typst-library/src/visualize/image/mod.rs index 379c25ba7..e7b952f75 100644 --- a/crates/typst-library/src/visualize/image/mod.rs +++ b/crates/typst-library/src/visualize/image/mod.rs @@ -124,7 +124,7 @@ pub struct ImageElem { /// The height of the image. pub height: Sizing, - /// A text describing the image. + /// An alternative description of the image. pub alt: Option, /// How the image should adjust itself to a given area (the area is defined diff --git a/crates/typst-pdf/src/tags/mod.rs b/crates/typst-pdf/src/tags/mod.rs index ef7b294d6..a00c76932 100644 --- a/crates/typst-pdf/src/tags/mod.rs +++ b/crates/typst-pdf/src/tags/mod.rs @@ -123,9 +123,9 @@ pub(crate) fn handle_start( } else { TagKind::Figure.with_alt_text(alt) } - } else if let Some(_) = elem.to_packed::() { - // TODO: alt text - TagKind::Formula.into() + } else if let Some(equation) = elem.to_packed::() { + let alt = equation.alt.get_as_ref().map(|s| s.to_string()); + TagKind::Formula.with_alt_text(alt) } else if let Some(table) = elem.to_packed::() { let table_id = gc.tags.next_table_id(); let summary = table.summary.get_as_ref().map(|s| s.to_string());