@@ -1525,8 +1525,17 @@ where
1525
1525
return ( false , container, should_continue) ;
1526
1526
}
1527
1527
}
1528
- NodeValue :: Alert ( ..) => {
1529
- if !self . parse_block_quote_prefix ( line) {
1528
+ NodeValue :: Alert ( ref alert) => {
1529
+ if alert. multiline {
1530
+ if !self . parse_multiline_block_quote_prefix (
1531
+ line,
1532
+ container,
1533
+ ast,
1534
+ & mut should_continue,
1535
+ ) {
1536
+ return ( false , container, should_continue) ;
1537
+ }
1538
+ } else if !self . parse_block_quote_prefix ( line) {
1530
1539
return ( false , container, should_continue) ;
1531
1540
}
1532
1541
}
@@ -2033,20 +2042,32 @@ where
2033
2042
2034
2043
let alert_startpos = self . first_nonspace ;
2035
2044
let mut title_startpos = self . first_nonspace ;
2045
+ let mut fence_length = 0 ;
2036
2046
2037
2047
while line[ title_startpos] != b']' {
2048
+ if line[ title_startpos] == b'>' {
2049
+ fence_length += 1
2050
+ }
2038
2051
title_startpos += 1 ;
2039
2052
}
2040
2053
title_startpos += 1 ;
2041
2054
2055
+ if fence_length == 2
2056
+ || ( fence_length >= 3 && !self . options . extension . multiline_block_quotes )
2057
+ {
2058
+ return false ;
2059
+ }
2060
+
2042
2061
// anything remaining on this line is considered an alert title
2043
2062
let mut tmp = entity:: unescape_html ( & line[ title_startpos..] ) ;
2044
2063
strings:: trim ( & mut tmp) ;
2045
2064
strings:: unescape ( & mut tmp) ;
2046
2065
2047
2066
let na = NodeAlert {
2048
2067
alert_type,
2049
- multiline : false ,
2068
+ multiline : fence_length >= 3 ,
2069
+ fence_length,
2070
+ fence_offset : self . first_nonspace - self . offset ,
2050
2071
title : if tmp. is_empty ( ) {
2051
2072
None
2052
2073
} else {
@@ -2077,8 +2098,8 @@ where
2077
2098
self . find_first_nonspace ( line) ;
2078
2099
let indented = self . indent >= CODE_INDENT ;
2079
2100
2080
- if self . handle_multiline_blockquote ( container, line, indented, & mut matched )
2081
- || self . handle_alert ( container, line, indented)
2101
+ if self . handle_alert ( container, line, indented)
2102
+ || self . handle_multiline_blockquote ( container, line, indented, & mut matched )
2082
2103
|| self . handle_blockquote ( container, line, indented)
2083
2104
|| self . handle_atx_heading ( container, line, indented, & mut matched)
2084
2105
|| self . handle_code_fence ( container, line, indented, & mut matched)
@@ -2397,6 +2418,7 @@ where
2397
2418
NodeValue :: MultilineBlockQuote ( ref node_value) => {
2398
2419
( node_value. fence_length , node_value. fence_offset )
2399
2420
}
2421
+ NodeValue :: Alert ( ref node_value) => ( node_value. fence_length , node_value. fence_offset ) ,
2400
2422
_ => unreachable ! ( ) ,
2401
2423
} ;
2402
2424
0 commit comments