Skip to content

In Japanese, Emphasis and Strong have a bug #1107

Closed as not planned
Closed as not planned
@Neos21

Description

@Neos21

Initial checklist

Affected packages and versions

[email protected], [email protected]

Link to runnable example

No response

Steps to reproduce

I use Node.js v18.12.1 and npm v8.19.2. I wrote vanilla Node.js script.

  • package.json : devDependencies
{
  "rehype-stringify": "9.0.3",
  "remark-parse": "10.0.1",
  "remark-rehype": "10.1.0",
  "unified": "10.1.2"
}
  • Code:
import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';

const processor = unified()
  .use(remarkParse)
  .use(remarkRehype)
  .use(rehypeStringify);
const result = processor.processSync(`
1. 日本語*強調*、日本語
2. 日本語*強調*。日本語
3. 日本語*強調、*日本語
4. 日本語*強調。*日本語
5. 日本語**強調**、日本語
6. 日本語**強調**。日本語
7. 日本語**強調、**日本語
8. 日本語**強調。**日本語
`);
console.log(result.value);
  • 8 examples.
  • The first 4 examples are wanted to convert to <em>
  • The last 4 examples are wanted to convert to <strong>
  • But, No. 3, 4, and 7, 8 were not converted.
    • I think a regexp has a bug with the character and maybe...?

Expected behavior

<ol>
<li>日本語<em>強調</em>、日本語</li>
<li>日本語<em>強調</em>。日本語</li>
<li>日本語<em>強調、</em>日本語</li>
<li>日本語<em>強調。</em>日本語</li>
<li>日本語<strong>強調</strong>、日本語</li>
<li>日本語<strong>強調</strong>。日本語</li>
<li>日本語<strong>強調、</strong>日本語</li>
<li>日本語<strong>強調。</strong>日本語</li>
</ol>

Actual behavior

<ol>
<li>日本語<em>強調</em>、日本語</li>
<li>日本語<em>強調</em>。日本語</li>
<li>日本語*強調、*日本語</li>
<li>日本語*強調。*日本語</li>
<li>日本語<strong>強調</strong>、日本語</li>
<li>日本語<strong>強調</strong>。日本語</li>
<li>日本語**強調、**日本語</li>
<li>日本語**強調。**日本語</li>
</ol>

Runtime

Node v17, Other (please specify in steps to reproduce)

Package manager

npm 8

OS

Windows

Build and bundle tools

Other (please specify in steps to reproduce)

Metadata

Metadata

Assignees

No one assigned

    Labels

    👎 phase/noPost cannot or will not be acted on🙅 no/wontfixThis is not (enough of) an issue for this project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions