coteditor / CotEditor

Lightweight Plain-Text Editor for macOS
https://coteditor.com
Other
6.38k stars 431 forks source link

An issue of Markdown parsing with URLs #1554

Closed tatsy-ymj closed 6 months ago

tatsy-ymj commented 10 months ago

Description

I observe a strange phenomenon regarding markdown containing URLs. For the following URLs, both can be clicked in CotEditor and opened in the browser, whether they are in markdown notation or the url is written directly.

https://ja.wikipedia.org/wiki/%E3%83%8B%E3%83%A5%E3%83%BC%E3%83%A8%E3%83%BC%E3%82%AF%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1939%E5%B9%B4)

https://ja.wikipedia.org/wiki/%E3%83%96%E3%83%AA%E3%83%A5%E3%83%83%E3%82%BB%E3%83%AB%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1935%E5%B9%B4)

However, the following URL has no problem for direct writing, but cannot be opened in markdown (the parentheses at the end are recognized as double).

https://ja.wikipedia.org/wiki/%E3%83%90%E3%83%AB%E3%82%BB%E3%83%AD%E3%83%8A%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1929%E5%B9%B4)

https://ja.wikipedia.org/wiki/%E3%82%B7%E3%82%AB%E3%82%B4%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1933%E5%B9%B4)

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

No response

CotEditor version

4.7.0-rc (615)

macOS version

14.1.2(23B92)

Additional context

No response

1024jp commented 10 months ago

Thank you for the report. I also observed the phenomenon.

Actually, CotEditor let the system API detect URLs. That means, honestly, I have nothing to do to fix this issue directly at the moment. So, for the first step, I'll report this to Apple. Then, I'll also try to see if there is another way to detect URL more correctly.

1024jp commented 10 months ago

Test code


- ニューヨーク万国博覧会 (1939年)
    - https://ja.wikipedia.org/wiki/%E3%83%8B%E3%83%A5%E3%83%BC%E3%83%A8%E3%83%BC%E3%82%AF%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1939%E5%B9%B4)
    - [ニューヨーク万国博覧会 (1939年) - Wikipedia](https://ja.wikipedia.org/wiki/%E3%83%8B%E3%83%A5%E3%83%BC%E3%83%A8%E3%83%BC%E3%82%AF%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1939%E5%B9%B4))
- ブリュッセル万国博覧会 (1935年)
    - https://ja.wikipedia.org/wiki/%E3%83%96%E3%83%AA%E3%83%A5%E3%83%83%E3%82%BB%E3%83%AB%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1935%E5%B9%B4)
    - [ブリュッセル万国博覧会 (1935年) - Wikipedia](https://ja.wikipedia.org/wiki/%E3%83%96%E3%83%AA%E3%83%A5%E3%83%83%E3%82%BB%E3%83%AB%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1935%E5%B9%B4))
- バルセロナ万国博覧会 (1929年)
    - https://ja.wikipedia.org/wiki/%E3%83%90%E3%83%AB%E3%82%BB%E3%83%AD%E3%83%8A%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1929%E5%B9%B4)
    - [バルセロナ万国博覧会 (1929年) - Wikipedia](https://ja.wikipedia.org/wiki/%E3%83%90%E3%83%AB%E3%82%BB%E3%83%AD%E3%83%8A%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1929%E5%B9%B4))
- シカゴ万国博覧会 (1933年)
    - https://ja.wikipedia.org/wiki/%E3%82%B7%E3%82%AB%E3%82%B4%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1933%E5%B9%B4)
    - [シカゴ万国博覧会 (1933年) - Wikipedia](https://ja.wikipedia.org/wiki/%E3%82%B7%E3%82%AB%E3%82%B4%E4%B8%87%E5%9B%BD%E5%8D%9A%E8%A6%A7%E4%BC%9A_(1933%E5%B9%B4))
1024jp commented 10 months ago

Sent the feedback to Apple FB13459501.

Then, I'll also try to see if there is another way to detect URL more correctly.

I tried Swift.Regex for the alternative, but the results were worse. I suppose it's better to wait for Apple to improve the APIs.

1024jp commented 6 months ago

I close this issue because this is an issue that needs to be addressed by the Apple side of the API.