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

Quoted terms are not detected as emphasis, in Japanese text #80

Closed
piroor opened this issue Jan 23, 2018 · 3 comments
Closed

Quoted terms are not detected as emphasis, in Japanese text #80

piroor opened this issue Jan 23, 2018 · 3 comments

Comments

@piroor
Copy link

piroor commented Jan 23, 2018

Description

Generally I can emphasize a quoted term in English like as:

$ echo 'before *"phrase"* after'  | build/src/cmark-gfm 
<p>before <em>&quot;phrase&quot;</em> after</p>

On the other hand, its translated version in Japanese is not emphasized same to above:

$ echo '前*「フレーズ」*後'  | build/src/cmark-gfm 
<p>前*「フレーズ」*後</p>

(Note:

  • means before
  • (`\u300c*) is an open quote
  • フレーズ means phrase
  • (`\u300d*) is a close quote
  • means after

)

Both English version and Japanese version examples should be parsed in the same way.

Steps to reproduce

  1. Clone the repository: git clone https://github.com/github/cmark.git
  2. CD to the repository: cd cmark
  3. Build the command line tool: make
  4. Try to parse a emphasis for quoted term echo '前*「フレーズ」*後' | build/src/cmark-gfm

Expected result

<p>前<em>「フレーズ」</em>後</p>

Actual result

<p>前*「フレーズ」*後</p>

Details

It seems to be parsed based on the rule described at https://github.com/github/cmark/blob/master/test/spec.txt#L6346 :

This is not emphasis, because the opening `*` is preceded
by an alphanumeric and followed by punctuation, and hence
not part of a [left-flanking delimiter run]:

```````````````````````````````` example
a*"foo"*
.
<p>a*&quot;foo&quot;*</p>

However, in Japanese (and some other languages), terms are not separated with white spaces and emphasized quoted terms are generally written like as the example above.

@piroor piroor changed the title Quoted terms are not detected as a emphasis in Japanese text Quoted terms are not detected as an emphasis, in Japanese text Jan 23, 2018
@piroor piroor changed the title Quoted terms are not detected as an emphasis, in Japanese text Quoted terms are not detected as emphasis, in Japanese text Jan 23, 2018
@piroor
Copy link
Author

piroor commented Jan 23, 2018

is defined as a punctuation at https://github.com/github/cmark/blob/master/src/utf8.c#L255.

@kivikakk
Copy link

Hey, thanks for your issue. I believe this is an issue with the spec itself rather than our implementation, and I think there's already an open PR to the spec that should address this issue! Please see commonmark#208; it'd be helpful if you could add your voice to that PR to help it get momentum!

@kivikakk
Copy link

(Here's some more discussion context: https://talk.commonmark.org/t/emphasis-and-east-asian-text/2491)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants