use tracing::trace;
use super::{BlockKind, leading_indent};
fn is_indented_code_line(line: &str) -> bool {
let (indent_width, first_content_byte) = leading_indent(line);
indent_width >= 4
&& line[first_content_byte..]
.chars()
.any(|c| !c.is_whitespace())
}
fn is_table_or_separator(line: &str) -> bool {
line.trim_start().starts_with('|') || crate::table::SEP_RE.is_match(line.trim())
}
pub(super) fn is_passthrough_block(block_kind: Option<BlockKind>, line: &str) -> bool {
is_table_or_separator(line)
|| matches!(
block_kind,
Some(
BlockKind::Heading
| BlockKind::MarkdownlintDirective
| BlockKind::LinkReferenceDefinition
| BlockKind::ThematicBreak,
)
)
|| line.trim().is_empty()
|| is_indented_code_line(line)
}
pub(super) fn normalized_passthrough_line(line: &str) -> &str {
if !line.is_empty() && line.trim().is_empty() {
trace!(
line_len = line.len(),
"normalizing whitespace-only passthrough line"
);
""
} else {
line
}
}