Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: 約物・記号すぐ外側の***を(日本語が隣である限り)認識させる #193

Open
tats-u opened this issue Feb 22, 2025 · 0 comments
Labels
spec Spec related thing

Comments

@tats-u
Copy link

tats-u commented Feb 22, 2025

Goals

**このアスタリスクは強調記号として認識されず、そのまま表示されます。**この文のせいで。

CommonMarkには、**の内側が約物または記号、かつ外側が両者以外だと正しく認識されないという仕様バグがあります。そのため、Markdownで太字を使いたい場合に、その箇所の内側の文字が約物かどうかにどうかに余計なリソースを割かなければなりません。VFMもCommonMarkベースなので影響を受けます。

両隣の文字の最低片方が日本語(日中韓)ならばこの約物判定をスキップできるようにしても、CommonMarkの既存のテストは全て突破しつつ(日中韓以外の言語への影響を最低限に抑えつつ)、ほとんどの日本語での問題ケースを解消できます。

https://github.com/tats-u/markdown-cjk-friendly
https://qiita.com/tats-u/items/f571313793b367d7c326
https://qiita.com/Yarakashi_Kikohshi/items/f5ebd1273cb6c0681da1
https://qiita.com/yusuke_s_yusuke/items/303436e1a164b118936d

VFMのユーザは日本人が多いのでこの仕様拡張は有益だと思います。

仕様:https://github.com/tats-u/markdown-cjk-friendly/blob/main/specification.md (英語)

Prior Art

  • djot→内側の文字が約物かどうかでは判定していない、ただし*が太字、_が斜体で互換性なし
  • AsciiDoc→**にこのようなルールはない(*はCommonMarkの__相当)、ただしそもそもMarkdownではない

Discussion

不都合な点があれば教えて下さい(異体字セレクタ・絵文字判定絡みで2つ前の文字を把握する必要がありますがそこは何とか)

@tats-u tats-u added the spec Spec related thing label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Spec related thing
Projects
None yet
Development

No branches or pull requests

1 participant