private static boolean hasDocumentSeparatorBefore(int offset, CharSequence sequence) {
    if (offset < 3) return false;
    if (!sequence.subSequence(offset - 3, offset).equals("---")) return false;
    return offset == 3 || sequence.charAt(offset - 4) == '\n';
  }
private static boolean hasDocumentSeparatorBefore(int offset, CharSequence sequence)