pub struct Body {Show 14 fields
pub blocks: Vec<Block>,
pub headings: Vec<Heading>,
pub links: Vec<Link>,
pub footnote_refs: Vec<(String, usize)>,
pub footnote_defs: Vec<(String, usize)>,
pub ref_defs: Vec<(String, String, usize)>,
pub inline_html: Vec<usize>,
pub fenced: Vec<(usize, usize)>,
pub code_blocks: Vec<CodeBlock>,
pub code_spans: Vec<(usize, usize, usize)>,
pub link_spans: Vec<(usize, usize, usize)>,
pub anchors: Vec<Anchor>,
pub reading_changes: Vec<(usize, usize, usize, String)>,
pub first_line: usize,
}Expand description
A parsed body.
Fields§
§blocks: Vec<Block>The blocks, in order, headings excluded.
headings: Vec<Heading>The headings, in order.
links: Vec<Link>Every link and image, include interiors and the definition block excluded.
footnote_refs: Vec<(String, usize)>Footnote references: label and line.
footnote_defs: Vec<(String, usize)>Footnote definitions: label and line.
ref_defs: Vec<(String, String, usize)>The link reference definitions outside the generated block, those in a list item or a quote among them, as comrak reads them: label, destination as written, and the line of the label, in order.
inline_html: Vec<usize>Lines carrying inline HTML other than a comment.
fenced: Vec<(usize, usize)>Line ranges of fenced and indented code, inclusive: the lines of
each entry of code_blocks.
code_blocks: Vec<CodeBlock>Every code block, at any depth of quotes, lists, and footnotes, in the order of the document; none inside a region or the trailer.
code_spans: Vec<(usize, usize, usize)>Byte ranges a code span covers: line, start, end. A span crossing lines records one entry per line.
link_spans: Vec<(usize, usize, usize)>Byte ranges a link’s text and destination cover: line, start, end,
as code_spans.
anchors: Vec<Anchor>The generated anchors, removed from the text before it was parsed
(TLMD_107).
reading_changes: Vec<(usize, usize, usize, String)>Each change that the readings of the units and the headings make on one line, in order: the line, the start and the end of the bytes that it replaces in the line without its anchors, and what the reading writes in their place.
first_line: usizeThe line the body starts on.
Implementations§
Source§impl Body
impl Body
Sourcepub fn nested_headings(&self) -> Vec<Heading>
pub fn nested_headings(&self) -> Vec<Heading>
Each heading inside a list item or a quote, at any depth, in the
order of the document, with the slug of TLMD_101. Such a heading is
part of its block, not a heading of the document (TLMD_173), but a
host that resolves a link to it needs it.
Sourcepub fn blocks_between(&self, from: usize, to: usize) -> Vec<&Block>
pub fn blocks_between(&self, from: usize, to: usize) -> Vec<&Block>
The blocks between from (exclusive) and to (exclusive), as a
section’s body.
Sourcepub fn clean_line<'a>(&self, line: usize, text: &'a str) -> Cow<'a, str>
pub fn clean_line<'a>(&self, line: usize, text: &'a str) -> Cow<'a, str>
text, the line numbered line as written, without the generated
anchors the parse removed from it.
Sourcepub fn read_line(&self, line: usize, text: &str) -> Reading
pub fn read_line(&self, line: usize, text: &str) -> Reading
text, the line numbered line without its anchors, in its reading:
each change that the readings of the units and the headings make on
the line applied, each byte mapped to its byte of text.
Sourcepub fn in_code_span(&self, line: usize, col: usize) -> bool
pub fn in_code_span(&self, line: usize, col: usize) -> bool
Whether byte col of line lies inside a code span.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Body
impl<'de> Deserialize<'de> for Body
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Body, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Body, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Body
Source§impl Serialize for Body
impl Serialize for Body
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Body
Auto Trait Implementations§
impl Forget for Body
impl Freeze for Body
impl Move for Body
impl RefUnwindSafe for Body
impl Send for Body
impl Sync for Body
impl Unpin for Body
impl UnsafeUnpin for Body
impl UnwindSafe for Body
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.