File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,8 @@ pub fn parse<'a>(input: &'a str, comment_string: &str) -> Vec<Token<'a>> {
6666 toks. push ( Token :: FencedCodeBlock ( line) ) ;
6767 in_code_fence = Some ( fence) ;
6868 } else if line. starts_with ( comment_string) {
69- let t = if & line[ 1 ..] == " ------------------------ >8 ------------------------" {
69+ let index = comment_string. len ( ) ;
70+ let t = if & line[ index..] == " ------------------------ >8 ------------------------" {
7071 has_scissors = true ;
7172 Token :: Scissored ( line)
7273 } else {
@@ -1742,4 +1743,34 @@ do
17421743 ] ,
17431744 ) ;
17441745 }
1746+ #[ test]
1747+ fn parses_scissored_content_with_custom_multichar_comment_string ( ) {
1748+ assert_eq ! (
1749+ super :: parse(
1750+ "
1751+ subject
1752+
1753+ # ------------------------ >8 ------------------------
1754+ above is not a comment;
1755+ do the needful
1756+
1757+ ## ------------------------ >8 ------------------------
1758+ do
1759+ not
1760+ format
1761+ " , "##"
1762+ ) ,
1763+ [
1764+ VerticalSpace ,
1765+ Subject ( "subject" ) ,
1766+ VerticalSpace ,
1767+ Paragraph ( "# ------------------------ >8 ------------------------ above is not a comment; do the needful" . into( ) ) ,
1768+ VerticalSpace ,
1769+ Scissored ( "## ------------------------ >8 ------------------------" ) ,
1770+ Scissored ( "do" ) ,
1771+ Scissored ( " not" ) ,
1772+ Scissored ( " format" ) ,
1773+ ] ,
1774+ ) ;
1775+ }
17451776}
You can’t perform that action at this time.
0 commit comments