Sign up (with export icon)

engine/conversion/comparemarkers

Api-module iconmodule

Functions

  • Chevron-right icon

    compareMarkersForDowncast( __namedParameters, __namedParameters ) → number
    internal

    Sorts 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):

    1. Non-overlapping ranges — sorted by position, last range first:

      a: [--]               →   c, b, a
      b:     [--]
      c:        [--]
      
      Copy code
    2. Adjacent ranges (end === start) — treated as non-overlapping:

      first:  [---]         →   third, second, first
      second:    [---]
      third:        [---]
      
      Copy code
    3. Nested ranges (same start, different ends) — inner first, outer last:

      shorter: [-]          →   shorter, longer
      longer:  [---]
      
      Copy code
    4. Partially overlapping ranges — sorted by start position:

      earlier: [---]        →   later, earlier
      later:     [---]
      
      Copy code
    5. Identical ranges — fall back to reverse name comparison:

      alpha:   [---]        →   charlie, bravo, alpha
      bravo:   [---]
      charlie: [---]
      
      Copy code

    Parameters

    __namedParameters : readonly tuple
    __namedParameters : readonly tuple

    Returns

    number