Skip to content

Commit

Permalink
🎨 Protyle Improve the handling of inline-math containing | in the t…
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Sep 25, 2023
1 parent 94bd2a2 commit 1b47323
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lex/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,17 @@ func RepeatBackslashBeforePipe(content string) string {
if ItemPipe == b {
if ItemBackslash != last {
buf.WriteByte(ItemBackslash)
backslashCnt = 0
} else {
backslashCnt++
}
if 1 < backslashCnt {
buf.WriteByte(ItemBackslash)
}
}
last = b
if ItemBackslash == last {
backslashCnt++
} else {
backslashCnt = 0
}
buf.WriteByte(b)
}
return buf.String()
Expand Down
3 changes: 2 additions & 1 deletion test/protyle_export_md_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import (

var protyleExportMdTests = []parseTest{

//{"9", "| $foo\\\\|bar$ |\n| -- |", "|$foo\\\\\\|bar$|\n| -|\n\n{: id=\"20060102150405-1a2b3c4\" updated=\"20060102150405\" type=\"doc\"}\n"},
{"10", "| $foo\\\\\\|bar$ |\n| -- |", "|$foo\\\\\\\\|bar$|\n| -|\n\n{: id=\"20060102150405-1a2b3c4\" updated=\"20060102150405\" type=\"doc\"}\n"},
{"9", "| $foo\\\\|bar$ |\n| -- |", "|$foo\\\\\\|bar$|\n| -|\n\n{: id=\"20060102150405-1a2b3c4\" updated=\"20060102150405\" type=\"doc\"}\n"},
{"8", "| $foo\\|bar$ |\n| -- |", "|$foo\\|bar$|\n| -|\n\n{: id=\"20060102150405-1a2b3c4\" updated=\"20060102150405\" type=\"doc\"}\n"},
{"7", "[~\\~foo\\~foo\\~~](bar)", "[~\\~foo\\~foo\\~~](bar)\n\n{: id=\"20060102150405-1a2b3c4\" updated=\"20060102150405\" type=\"doc\"}\n"},
{"6", "[^\\^foo\\^foo\\^^](bar)", "[^\\^foo\\^foo\\^^](bar)\n\n{: id=\"20060102150405-1a2b3c4\" updated=\"20060102150405\" type=\"doc\"}\n"},
Expand Down

0 comments on commit 1b47323

Please sign in to comment.