engine/conversion/comparemarkers
module
Functions
compareMarkersForDowncast( __namedParameters, __namedParameters ) → numberinternalmodule:engine/conversion/comparemarkers~compareMarkersForDowncastSorts markers so the downcast result is deterministic regardless of the order markers were added to the marker collection.
The sort key is the marker's range, ordered "right-to-left" through the document so that a marker's opening boundary is processed after any markers nested inside it. This way the outer marker wraps the inner ones at conversion time.
Cases (positions shown as
0123456789, sort result top-to-bottom):Non-overlapping ranges — sorted by position, last range first:
a: [--] → c, b, a b: [--] c: [--]Copy codeAdjacent ranges (end === start) — treated as non-overlapping:
first: [---] → third, second, first second: [---] third: [---]Copy codeNested ranges (same start, different ends) — inner first, outer last:
shorter: [-] → shorter, longer longer: [---]Copy codePartially overlapping ranges — sorted by start position:
earlier: [---] → later, earlier later: [---]Copy codeIdentical ranges — fall back to reverse name comparison:
alpha: [---] → charlie, bravo, alpha bravo: [---] charlie: [---]Copy code
Parameters
__namedParameters : readonly tuple__namedParameters : readonly tuple
Returns
number