Repository: typst/typst
File: docs/src/lib.rs (Rust)

Code before:
                eco_format!("{}.{}", name, variant.as_str())
            }
        };

        for (variant, value, deprecation_message) in symbol.variants() {
            let value_char = value.parse::<char>().ok();

            let shorthand = |list: &[(&'static str, char)]| {
                value_char.and_then(|c| {
                    list.iter().copied().find(|&(_, x)| x == c).map(|(s, _)| s)
                })
            };

            let name = complete(variant);

            list.push(SymbolModel {
                name,
                markup_shorthand: shorthand(typst::syntax::ast::Shorthand::LIST),
                math_shorthand: shorthand(typst::syntax::ast::MathShorthand::LIST),
                // Matches `typst_layout::math::GlyphFragment::new`
                math_class: value.chars().next().and_then(|c| {
                    typst_utils::default_math_class(c).map(math_class_name)
                }),
                value: value.into(),
                // Matches casting `Symbol` to `Accent`
                accent: typst::math::Accent::combine(value).is_some(),
                alternates: symbol
                    .variants()
                    .filter(|(other, _, _)| other != &variant)
                    .map(|(other, _, _)| complete(other))
                    .collect(),
                deprecation_message: deprecation_message
                    .or_else(|| binding.deprecation().map(Deprecation::message)),
                deprecation_until: binding.deprecation().and_then(Deprecation::until),
            });
        }
    }

    SymbolsModel {
        name: group.name.clone(),
        title: group.title.clone(),
        details: Html::markdown(resolver, &group.details, Some(1)),
        list,
    }
}

/// Extract a module from another module.
#[track_caller]
fn get_module<'a>(parent: &'a Module, name: &str) -> StrResult<&'a Module> {
    match parent.scope().get(name).map(Binding::read) {
        Some(Value::Module(module)) => Ok(module),

Review comment (suggestion):
I'm not sure this was true before (and it's not now either) because the cast uses `Accent::new`, not `Accent::combine`.

Code after:
    let mut list = vec![];
    for (name, binding) in group.module().scope().iter() {
        let Value::Symbol(symbol) = binding.read() else { continue };
        let complete = |variant: codex::ModifierSet<&str>| {
            if variant.is_empty() {
                name.clone()
            } else {
                eco_format!("{}.{}", name, variant.as_str())
            }
        };

        for (variant, value, deprecation_message) in symbol.variants() {
            let value_char = value.parse::<char>().ok();

            let shorthand = |list: &[(&'static str, char)]| {
                value_char.and_then(|c| {
                    list.iter().copied().find(|&(_, x)| x == c).map(|(s, _)| s)
                })
            };

            let name = complete(variant);

            list.push(SymbolModel {
                name,
                markup_shorthand: shorthand(typst::syntax::ast::Shorthand::LIST),
                math_shorthand: shorthand(typst::syntax::ast::MathShorthand::LIST),
                // Matches `typst_layout::math::GlyphFragment::new`
                math_class: value.chars().next().and_then(|c| {
                    typst_utils::default_math_class(c).map(math_class_name)
                }),
                value: value.into(),
                // Matches casting `Symbol` to `Accent`
                accent: value_char
                    .is_some_and(|c| typst::math::Accent::combine(c).is_some()),
                alternates: symbol
                    .variants()
                    .filter(|(other, _, _)| other != &variant)
                    .map(|(other, _, _)| complete(other))
                    .collect(),
                deprecation_message: deprecation_message
                    .or_else(|| binding.deprecation().map(Deprecation::message)),
                deprecation_until: binding.deprecation().and_then(Deprecation::until),
            });
        }
    }

    SymbolsModel {
        name: group.name.clone(),
        title: group.title.clone(),
        details: Html::markdown(resolver, &group.details, Some(1)),
        list,