Skip to main content

strip_roxygen_from_attrs

Function strip_roxygen_from_attrs 

Source
pub(crate) fn strip_roxygen_from_attrs(attrs: &[Attribute]) -> Vec<Attribute>
Expand description

Strip roxygen tag lines from doc attributes, keeping only regular documentation.

Returns a new vector of attributes with roxygen lines removed from doc comments. Non-doc attributes are passed through unchanged.

§Algorithm

Roxygen tags typically appear at the end of documentation blocks. We use a simple but effective approach:

  1. Keep all content before the first @tag line
  2. Strip everything from the first @tag to the end of the roxygen region

A roxygen region ends when we see a non-empty line that doesn’t start with @ and follows an empty line (paragraph break). This handles multi-paragraph tags.