comparing begin and end offsets for top-level sections and headlines.

This commit is contained in:
Tom Alexander
2023-04-11 19:16:04 -04:00
parent 276e8abb13
commit 52b401d548
6 changed files with 109 additions and 6 deletions

View File

@@ -74,6 +74,18 @@ impl<'s> Source<'s> for DocumentElement<'s> {
}
}
impl<'s> Source<'s> for Section<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
impl<'s> Source<'s> for Heading<'s> {
fn get_source(&'s self) -> &'s str {
self.source
}
}
#[tracing::instrument(ret, level = "debug")]
#[allow(dead_code)]
pub fn document(input: &str) -> Res<&str, Document> {

View File

@@ -17,4 +17,6 @@ mod util;
pub use document::document;
pub use document::Document;
pub use document::Section;
pub use document::Heading;
pub use source::Source;
type Context<'r, 's> = &'r parser_context::ContextTree<'r, 's>;