pub struct LineInfo {Show 35 fields
pub byte_offset: usize,
pub byte_len: usize,
pub indent: usize,
pub visual_indent: usize,
pub is_blank: bool,
pub in_code_block: bool,
pub in_front_matter: bool,
pub in_html_block: bool,
pub in_list_block: bool,
pub in_table_block: bool,
pub in_html_comment: bool,
pub list_item: Option<Box<ListItemInfo>>,
pub heading: Option<Box<HeadingInfo>>,
pub blockquote: Option<Box<BlockquoteInfo>>,
pub in_mkdocstrings: bool,
pub in_esm_block: bool,
pub in_code_span_continuation: bool,
pub is_horizontal_rule: bool,
pub in_math_block: bool,
pub in_pandoc_div: bool,
pub is_div_marker: bool,
pub in_jsx_expression: bool,
pub in_mdx_comment: bool,
pub in_admonition: bool,
pub in_content_tab: bool,
pub in_mkdocs_html_markdown: bool,
pub in_definition_list: bool,
pub in_obsidian_comment: bool,
pub in_pymdown_block: bool,
pub in_kramdown_extension_block: bool,
pub is_kramdown_block_ial: bool,
pub in_jsx_block: bool,
pub in_footnote_definition: bool,
pub in_myst_directive: bool,
pub is_myst_comment: bool,
}Expand description
Pre-computed information about a line
Fields§
§byte_offset: usizeByte offset where this line starts in the document
byte_len: usizeLength of the line in bytes (without newline)
indent: usizeNumber of bytes of leading whitespace (for substring extraction)
visual_indent: usizeVisual column width of leading whitespace (with proper tab expansion) Per CommonMark, tabs expand to the next column that is a multiple of 4. Use this for numeric comparisons like checking for indented code blocks (>= 4).
is_blank: boolWhether the line is blank (empty or only whitespace)
in_code_block: boolWhether this line is inside a code block
in_front_matter: boolWhether this line is inside front matter
in_html_block: boolWhether this line is inside an HTML block
in_list_block: boolWhether this line is part of a list block (precomputed for O(1) lookup)
in_table_block: boolWhether this line is part of a table block (precomputed for O(1) lookup)
in_html_comment: boolWhether this line is inside an HTML comment
list_item: Option<Box<ListItemInfo>>List item information if this line starts a list item Boxed to reduce LineInfo size: most lines are not list items
heading: Option<Box<HeadingInfo>>Heading information if this line is a heading Boxed to reduce LineInfo size: most lines are not headings
blockquote: Option<Box<BlockquoteInfo>>Blockquote information if this line is a blockquote Boxed to reduce LineInfo size: most lines are not blockquotes
in_mkdocstrings: boolWhether this line is inside a mkdocstrings autodoc block
in_esm_block: boolWhether this line is part of an ESM import/export block (MDX only)
in_code_span_continuation: boolWhether this line is a continuation of a multi-line code span from a previous line
is_horizontal_rule: boolWhether this line is a horizontal rule (—, ***, ___, etc.) Pre-computed for consistent detection across all rules
in_math_block: boolWhether this line is inside a math block ($$ … $$)
in_pandoc_div: boolWhether this line is inside a Pandoc/Quarto div block (::: … :::)
is_div_marker: boolWhether this line is a Quarto/Pandoc div marker (opening ::: {.class} or closing :::)
Analogous to is_horizontal_rule — marks structural delimiters that are not paragraph text
in_jsx_expression: boolWhether this line contains or is inside a JSX expression (MDX only)
in_mdx_comment: boolWhether this line is inside an MDX comment {/* … */} (MDX only)
in_admonition: boolWhether this line is inside an MkDocs admonition block (!!! or ???)
in_content_tab: boolWhether this line is inside an MkDocs content tab block (===)
in_mkdocs_html_markdown: boolWhether this line is inside an HTML block with markdown attribute (MkDocs grid cards, etc.)
in_definition_list: boolWhether this line is a definition list item (: definition)
in_obsidian_comment: boolWhether this line is inside an Obsidian comment (%%…%% syntax, Obsidian flavor only)
in_pymdown_block: boolWhether this line is inside a PyMdown Blocks region (/// … ///, MkDocs flavor only)
in_kramdown_extension_block: boolWhether this line is inside a kramdown extension block ({::comment}…{:/comment}, {::nomarkdown}…{:/nomarkdown})
is_kramdown_block_ial: boolWhether this line is a kramdown block IAL ({:.class #id}) or ALD ({:ref: .class})
in_jsx_block: boolWhether this line is inside a JSX component block (MDX only, e.g. <Tabs>...</Tabs>)
in_footnote_definition: boolWhether this line is inside a footnote definition body (continuation lines)
in_myst_directive: boolWhether this line is inside a MyST directive block (colon or backtick fence with {name})
is_myst_comment: boolWhether this line is a MyST comment (% comment)
Implementations§
Source§impl LineInfo
impl LineInfo
Sourcepub fn content<'a>(&self, source: &'a str) -> &'a str
pub fn content<'a>(&self, source: &'a str) -> &'a str
Get the line content as a string slice from the source document
Sourcepub fn in_mkdocs_container(&self) -> bool
pub fn in_mkdocs_container(&self) -> bool
Check if this line is inside MkDocs-specific indented content (admonitions, tabs, or markdown HTML). This content uses 4-space indentation which pulldown-cmark would interpret as code blocks, but in MkDocs flavor it’s actually container content that should be preserved.
Sourcepub fn is_paragraph_context(&self) -> bool
pub fn is_paragraph_context(&self) -> bool
Whether this line could be part of a paragraph block (CommonMark paragraph token).
Returns true for ordinary prose lines, including those inside blockquotes and list items. Returns false for lines that belong to non-paragraph blocks: headings, code blocks, HTML blocks, math blocks, horizontal rules, front matter, structural div markers, and flavor-specific extension blocks. This is the per-line view; cross-line constructs like setext underlines aren’t visible here and need additional context to detect.
Used by rules (e.g. MD009 strict mode) that need to distinguish “trailing whitespace
could produce a meaningful <br>” from “trailing whitespace is on a structural boundary.”