Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make node value fields public #216

Merged
merged 1 commit into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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