Struct markdown_it::parser::block::BlockState
source · [−]pub struct BlockState<'a, 'b>where
'b: 'a,{
pub src: &'b str,
pub md: &'a MarkdownIt,
pub root_ext: &'b mut RootExtSet,
pub node: Node,
pub line_offsets: Vec<LineOffset>,
pub blk_indent: usize,
pub line: usize,
pub line_max: usize,
pub tight: bool,
pub list_indent: Option<u32>,
pub level: u32,
}Expand description
Sandbox object containing data required to parse block structures.
Fields
src: &'b strMarkdown source.
md: &'a MarkdownItLink to parser instance.
root_ext: &'b mut RootExtSetnode: NodeCurrent node, your rule is supposed to add children to it.
line_offsets: Vec<LineOffset>blk_indent: usizeCurrent block content indent (for example, if we are inside a list, it would be positioned after list marker).
line: usizeCurrent line in src.
line_max: usizeMaximum allowed line in src.
tight: boolTrue if there are no empty lines between paragraphs, used to toggle loose/tight mode for lists.
list_indent: Option<u32>indent of the current list block.
level: u32Implementations
sourceimpl<'a, 'b> BlockState<'a, 'b>
impl<'a, 'b> BlockState<'a, 'b>
pub fn new(
src: &'b str,
md: &'a MarkdownIt,
root_ext: &'b mut RootExtSet,
node: Node
) -> Self
pub fn test_rules_at_line(&mut self) -> bool
pub fn is_empty(&self, line: usize) -> bool
pub fn skip_empty_lines(&self, from: usize) -> usize
pub fn line_indent(&self, line: usize) -> i32
pub fn get_line(&self, line: usize) -> &str
pub fn get_lines(
&self,
begin: usize,
end: usize,
indent: usize,
keep_last_lf: bool
) -> (String, Vec<(usize, usize)>)
pub fn get_map(&self, start_line: usize, end_line: usize) -> Option<SourcePos>
pub fn get_map_from_offsets(
&self,
start_pos: usize,
end_pos: usize
) -> Option<SourcePos>
Trait Implementations
Auto Trait Implementations
impl<'a, 'b> !RefUnwindSafe for BlockState<'a, 'b>
impl<'a, 'b> !Send for BlockState<'a, 'b>
impl<'a, 'b> !Sync for BlockState<'a, 'b>
impl<'a, 'b> Unpin for BlockState<'a, 'b>
impl<'a, 'b> !UnwindSafe for BlockState<'a, 'b>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s. Read more