@@ -364,7 +364,10 @@ where
364364 break ;
365365 }
366366 }
367- NodeValue :: Heading ( ..) | NodeValue :: TableRow ( ..) | NodeValue :: TableCell => {
367+ NodeValue :: Heading ( ..)
368+ | NodeValue :: TableRow ( ..)
369+ | NodeValue :: TableCell
370+ | NodeValue :: Subtext => {
368371 break ;
369372 }
370373 NodeValue :: FootnoteDefinition ( ..) => {
@@ -613,6 +616,7 @@ where
613616 || self . handle_multiline_blockquote ( container, line)
614617 || self . handle_blockquote ( container, line)
615618 || self . handle_atx_heading ( container, line)
619+ || self . handle_atx_subtext ( container, line)
616620 || self . handle_code_fence ( container, line)
617621 || self . handle_html_block ( container, line)
618622 || self . handle_setext_heading ( container, line)
@@ -782,6 +786,26 @@ where
782786 scanners:: atx_heading_start ( & line[ self . first_nonspace ..] )
783787 }
784788
789+ fn handle_atx_subtext ( & mut self , container : & mut Node < ' a > , line : & str ) -> bool {
790+ let Some ( matched) = self . detect_atx_subtext ( line) else {
791+ return false ;
792+ } ;
793+
794+ let heading_startpos = self . first_nonspace ;
795+ let offset = self . offset ;
796+ self . advance_offset ( line, heading_startpos + matched - offset, false ) ;
797+ * container = self . add_child ( container, NodeValue :: Subtext , heading_startpos + 1 ) ;
798+
799+ let container_ast = & mut container. data_mut ( ) ;
800+ container_ast. value = NodeValue :: Subtext ;
801+
802+ true
803+ }
804+
805+ fn detect_atx_subtext ( & self , line : & str ) -> Option < usize > {
806+ scanners:: atx_subtext_start ( & line[ self . first_nonspace ..] )
807+ }
808+
785809 fn handle_code_fence ( & mut self , container : & mut Node < ' a > , line : & str ) -> bool {
786810 let Some ( matched) = self . detect_code_fence ( line) else {
787811 return false ;
@@ -1328,7 +1352,10 @@ where
13281352
13291353 container. data_mut ( ) . last_line_blank = self . blank
13301354 && match container. data ( ) . value {
1331- NodeValue :: BlockQuote | NodeValue :: Heading ( ..) | NodeValue :: ThematicBreak => false ,
1355+ NodeValue :: BlockQuote
1356+ | NodeValue :: Heading ( ..)
1357+ | NodeValue :: ThematicBreak
1358+ | NodeValue :: Subtext => false ,
13321359 NodeValue :: CodeBlock ( ref ncb) => !ncb. fenced ,
13331360 NodeValue :: Item ( ..) => {
13341361 container. first_child ( ) . is_some ( )
0 commit comments