@@ -991,6 +991,22 @@ fn sentence_boundary(
991991 let c = chars[ pos] ;
992992 let next_char = chars[ pos + 1 ] ;
993993
994+ // A number immediately inside an opening emphasis delimiter is a step
995+ // label, not a sentence: **1. Verify** must never split after the 1.
996+ if c == '.' && next_char == ' ' {
997+ let mut number_start = pos;
998+ while number_start > 0 && chars[ number_start - 1 ] . is_ascii_digit ( ) {
999+ number_start -= 1 ;
1000+ }
1001+ if number_start < pos
1002+ && number_start > 0
1003+ && st. in_span_delimiter ( number_start - 1 )
1004+ && st. span_closer_end ( number_start - 1 ) . is_none ( )
1005+ {
1006+ return None ;
1007+ }
1008+ }
1009+
9941010 // Check for CJK sentence-ending punctuation (。, !, ?)
9951011 // CJK punctuation doesn't require space or uppercase after it
9961012 if is_cjk_sentence_ending ( c) {
@@ -1462,7 +1478,13 @@ fn sentence_structure(text: &str, defined_references: Option<&HashSet<String>>)
14621478 // neither and skips the parse entirely.
14631479 let holds_construct = text. contains ( [ '`' , '[' , '<' , '$' ] ) ;
14641480 let holds_cjk_emphasis = text. contains ( [ '*' , '_' , '~' ] ) && text. contains ( [ '。' , '!' , '?' ] ) ;
1465- if !holds_construct && !holds_cjk_emphasis {
1481+ // ASCII step labels also need the parse to distinguish an opening span
1482+ // delimiter from literal marker text before their leading number.
1483+ let holds_emphasized_number = text
1484+ . as_bytes ( )
1485+ . windows ( 2 )
1486+ . any ( |pair| matches ! ( pair[ 0 ] , b'*' | b'_' | b'~' ) && pair[ 1 ] . is_ascii_digit ( ) ) ;
1487+ if !holds_construct && !holds_cjk_emphasis && !holds_emphasized_number {
14661488 return NestedStructure {
14671489 atomic : Vec :: new ( ) ,
14681490 markers : Vec :: new ( ) ,
0 commit comments