Skip to content

Commit 1fc5bbc

Browse files
committed
Fix markdown for avoid convert any with underline surrounded for avoid change URL.
1 parent 4d93cf0 commit 1fc5bbc

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

autocorrect/grammar/markdown.pest

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
para = { ANY* ~ NEWLINE{2} }
2-
expr = _{ codeblock | img | link | td_tag | mark | heading }
2+
expr = _{ codeblock | img | link | td_tag | heading }
33
text = { (!(expr | newline) ~ ANY)+ }
44
newline = ${ "\n" | "\r" }
55
space = @{ (" ")* }
@@ -13,8 +13,6 @@ mark_tag = @{
1313
"**"
1414
| "*"
1515
| "~~"
16-
| "__"
17-
| "_"
1816
| "`"
1917
}
2018
heading_tag = @{"######" | "#####" | "####" | "###" | "##" | "#"}

autocorrect/src/code/markdown.rs

+16
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ mod tests {
1717
#[test]
1818
fn test_format_markdown() {
1919
let example = r###"
20+
---
21+
title: IPAD 和 Ios 接入的不同点
22+
id: h
23+
slug: /appstore/ipad_and_ios
24+
---
25+
2026
# 这是Heading 1大标题
2127
28+
https://google.com/foo/__ios__/**ios**
29+
2230
**加粗**
2331
*倾斜*
2432
~~删除线~~
@@ -57,8 +65,16 @@ mod tests {
5765
"###;
5866

5967
let expected = r###"
68+
---
69+
title: iPad 和 iOS 接入的不同点
70+
id: h
71+
slug: /appstore/ipad_and_ios
72+
---
73+
6074
# 这是 Heading 1 大标题
6175
76+
https://google.com/foo/__ios__/**ios**
77+
6278
**加粗**
6379
*倾斜*
6480
~~删除线~~

autocorrect/src/spellcheck.rs

+5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ mod tests {
5454
"this is ipad ios website, and the IOS download url" => "this is iPad iOS website, and the iOS download url",
5555
"Ios download" => "iOS download",
5656
"Download iOs" => "Download iOS",
57+
"hello_ios" => "hello_ios",
58+
"ios_hello" => "ios_hello",
59+
"'ios'" => "'ios'",
5760
"openios" => "openios",
61+
"diff_ws_ios\n" => "diff_ws_ios\n",
62+
"diff_ws_ios " => "diff_ws_ios ",
5863
"https://ios.com" => "https://ios.com",
5964
6065
"开放 IOS 接口" => "开放 iOS 接口",

0 commit comments

Comments
 (0)