Skip to content

Commit

Permalink
Merge pull request #216 from emschwartz/main
Browse files Browse the repository at this point in the history
Make node value fields public
  • Loading branch information
kivikakk authored May 20, 2022
2 parents 83702f9 + 2cf104a commit dc2d4b5
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ pub struct NodeList {
/// The kind of list (bullet (unordered) or ordered).
pub list_type: ListType,

pub(crate) marker_offset: usize,
pub(crate) padding: usize,
/// Number of spaces before the list marker.
pub marker_offset: usize,

/// Number of characters between the start of the list marker and the item text (including the list marker(s)).
pub padding: usize,

/// For ordered lists, the ordinal the list starts at.
pub start: usize,
Expand All @@ -212,8 +215,11 @@ pub struct NodeList {
/// The metadata of a description list
#[derive(Debug, Default, Clone, Copy)]
pub struct NodeDescriptionItem {
pub(crate) marker_offset: usize,
pub(crate) padding: usize,
/// Number of spaces before the list marker.
pub marker_offset: usize,

/// Number of characters between the start of the list marker and the item text (including the list marker(s)).
pub padding: usize,
}

/// The type of list.
Expand Down Expand Up @@ -260,7 +266,8 @@ pub struct NodeCodeBlock {
/// For fenced code blocks, the length of the fence.
pub fence_length: usize,

pub(crate) fence_offset: usize,
/// For fenced code blocks, the indentation level of the code within the block.
pub fence_offset: usize,

/// For fenced code blocks, the [info string](https://github.github.com/gfm/#info-string) after
/// the opening fence, if any.
Expand All @@ -285,7 +292,8 @@ pub struct NodeHeading {
/// The metadata of an included HTML block.
#[derive(Debug, Default, Clone)]
pub struct NodeHtmlBlock {
pub(crate) block_type: u8,
/// The HTML block's type
pub block_type: u8,

/// The literal contents of the HTML block. Per NodeCodeBlock, the content is included here
/// rather than in any inline.
Expand Down Expand Up @@ -408,7 +416,8 @@ pub(crate) fn last_child_is_open<'a>(node: &'a AstNode<'a>) -> bool {
node.last_child().map_or(false, |n| n.data.borrow().open)
}

pub(crate) fn can_contain_type<'a>(node: &'a AstNode<'a>, child: &NodeValue) -> bool {
/// Returns true if the given node can contain a node with the given value.
pub fn can_contain_type<'a>(node: &'a AstNode<'a>, child: &NodeValue) -> bool {
match *child {
NodeValue::Document => {
return false;
Expand Down

0 comments on commit dc2d4b5

Please sign in to comment.