private static function isStartOfRun()

in src/inlines/Emphasis.php [470:495]


  private static function isStartOfRun(
    Context $context,
    string $markdown,
    int $offset,
  ): bool {
    $first = $markdown[$offset];
    if ($first !== '*' && $first !== '_') {
      return false;
    }

    if ($offset === 0) {
      return true;
    }

    $previous = $markdown[$offset - 1];
    if ($previous !== "\\" && $previous !== $first) {
      return true;
    }

    $previous = parse(
      $context,
      Str\slice($markdown, 0, $offset),
    );

    return C\last($previous) is BackslashEscape;
  }