# Function rustc_resolve::rustdoc::source_span_for_markdown_range

source ·

    pub fn source_span_for_markdown_range(
        tcx: TyCtxt<'_>,
        markdown: &str,
        md_range: &Range<usize>,
        fragments: &[DocFragment]
    ) -> Option<Span>

Expand description

Attempts to match a range of bytes from parsed markdown to a `Span` in the source code.

This method will return `None` if we cannot construct a span from the source map or if the fragments are not all sugared doc comments. It’s difficult to calculate the correct span in that case due to escaping and other source features.