import { visit } from "../unist-util-visit/lib-index.js";
import { toString } from "../mdast-util-to-string/lib-index.js";
import { EXIT } from "../unist-util-visit-parents/lib-index.js";
function formatHeadingAsSetext(node, state) {
  let literalWithBreak = false;
  visit(node, function(node2) {
    if ("value" in node2 && /\r?\n|\r/.test(node2.value) || node2.type === "break") {
      literalWithBreak = true;
      return EXIT;
    }
  });
  return Boolean(
    (!node.depth || node.depth < 3) && toString(node) && (state.options.setext || literalWithBreak)
  );
}
export {
  formatHeadingAsSetext
};
//# sourceMappingURL=lib-util-format-heading-as-setext.js.map
