fn can_merge(class1: Option<Class>, class2: Option<Class>, text: &str) -> bool
Expand description
Check if two Class
can be merged together. In the following rules, “unclassified” means None
basically (since it’s Option<Class>
). The following rules apply:
- If two
Class
have the same variant, then they can be merged. - If the other
Class
is unclassified and only contains white characters (backline, whitespace, etc), it can be merged. Class::Ident
is considered the same as unclassified (because it doesn’t have an associated CSS class).