-
-
Notifications
You must be signed in to change notification settings - Fork 374
Closed as not planned
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙅 no/wontfixThis is not (enough of) an issue for this projectThis is not (enough of) an issue for this project
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and couldn’t find anything (or linked relevant results below)
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...?
- I think a regexp has a bug with the character
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
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙅 no/wontfixThis is not (enough of) an issue for this projectThis is not (enough of) an issue for this project