Skip to content

Commit

Permalink
markdown link fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sdfsdhgjkbmnmxc committed May 15, 2021
1 parent c0b93bd commit 309d1a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 0 additions & 6 deletions tdmarkup/markup_scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,6 @@ findRepl:
switch ch {
case ']':
break findRepl
case '(', ')', '[':
s.Rewind(start)
return "", nil
default:
replBuilder.WriteRune(ch)
}
Expand Down Expand Up @@ -436,9 +433,6 @@ findUrl:
switch ch {
case ')':
break findUrl
case '(', '[', ']':
s.Rewind(start)
return "", nil
default:
urlBuilder.WriteRune(ch)
}
Expand Down
13 changes: 13 additions & 0 deletions tdmarkup/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,23 @@ var MarkupTestCases = []struct {
Html: `<a href="https://ya.ru">ya.ru *bold*</a>`,
Plain: "ya.ru *bold*",
},
{
Title: "markdown link with smile",
Raw: `[=(](app://path)`,
Html: `<a href="app://path">=(</a>`,
Plain: "=(",
},
{
Title: "empty markdown link",
Raw: `[ ](https://ya.ru)`,
Html: `[ ](https://ya.ru)`,
Plain: `[ ](https://ya.ru)`,
},
// TODO:
//{
// Title: "markdown link with square brace",
// Raw: `[[x]](app://path)`,
// Html: `<a href="app://path">[x]</a>`,
// Plain: "[x]",
//},
}

0 comments on commit 309d1a7

Please sign in to comment.