Skip to content

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

@piroor

Description

@piroor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions