Skip to main content

classify

Function classify 

Source
pub fn classify(
    marker: u8,
    prev: Option<char>,
    next: Option<char>,
    tilde: bool,
) -> (bool, bool)
Expand description

Flanking classification, micromark’s attention.js version.

This deliberately follows micromark rather than the spec’s prose: on top of the left/right-flanking rules, a */_ run whose neighboring character is itself an attention marker (* _, and ~ with strikethrough on) may always open (next) / close (prev). A ~ run gets the plain attention rules, no marker relaxation, no _ adjustment (micromark’s gfm-strikethrough). Parse behavior targets micromark exactly, quirks included.

prev / next are the characters around the run; None is a boundary (whitespace class). Returns (can_open, can_close). Public as crate::attention for printers that must know whether a literal run they emit would pair up.