Skip to main content

extract_doc_comment_blocks

Function extract_doc_comment_blocks 

Source
pub fn extract_doc_comment_blocks(content: &str) -> Vec<DocCommentBlock>
Expand description

Extract all doc comment blocks from Rust source code.

Groups contiguous same-kind doc comment lines into blocks. A block boundary occurs when:

  • A line is not a doc comment
  • The doc comment kind changes (from /// to //! or vice versa)

Each block’s markdown field contains the extracted markdown with prefixes stripped. The line_metadata field preserves the original indentation and prefix for each line, enabling faithful restoration during fix mode.

Precondition: content must be LF-normalized (no \r\n).