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 does not always work, because markdown bytes don’t necessarily match source bytes,
like if escapes are used in the string. In this case, it returns None
.
This method will return Some
only if:
- The doc is made entirely from sugared doc comments, which cannot contain escapes
- The doc is entirely from a single doc fragment, with a string literal, exactly equal
- The doc comes from
include_str!