Skip to content

What is the NodeHtmlBlock block_type field, please? #351

Answered by kivikakk
mightyiam asked this question in Q&A
Discussion options

You must be logged in to vote

Haha, good call, it's not very clear, is it? Here's where it's assigned in the code:

comrak/src/parser/mod.rs

Lines 1052 to 1065 in 4c909b6

} else if !indented
&& (unwrap_into(
scanners::html_block_start(&line[self.first_nonspace..]),
&mut matched,
) || (!node_matches!(container, NodeValue::Paragraph)
&& unwrap_into(
scanners::html_block_start_7(&line[self.first_nonspace..]),
&mut matched,
)))
{
let nhb = NodeHtmlBlock {
block_type: matched as u8,
literal: String::new(),
};

This is also not very clear — tl;dr it stores a number from 1 to 7, corresponding to these seven start/end condition pairs in CommonMar…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mightyiam
Comment options

Answer selected by kivikakk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants