facebook / facebook/docusaurus
Support CJK Friendly Emphasis
- Dominant language
- TypeScript
- Stars
- 66.2k
- Forks
- 10k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 52
Description
### Have you read the Contributing Guidelines on issues?
- [x] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).
### Motivation
- https://github.com/vuejs/vitepress/commit/9fc8462726ccf1cdb78b6171c9f1f5964e79ca22
- https://github.com/web-infra-dev/rspress/issues/2772
- https://xoofx.github.io/markdig/docs/extensions/cjk-friendly-emphasis/
- https://github.com/web-infra-dev/rspress/releases/tag/v2.0.5
- https://streamdown.ai/docs/plugins/cjk
- https://github.com/facebook/docusaurus/pull/10892
We have to insert extra spaces for workaround:
Docusaurus 3 has a regression that asterisks `*`/`**` around punctuation including `` ` `` representing inline codes and `[`/`]` representing links are not recognized as emphasis. This affects especially on Chinese and Japanese documents.
https://docusaurus.io/docs/next/migration/v3#other-markdown-incompatibilities suggests using `remark-cjk-friendly` (https://github.com/facebook/docusaurus/pull/10892) but it should be opt-in or opt-out in the future.
There are two proposed methods for setting it up:
```ts
import type { Config } from "@docusaurus/types";
import type { Options } from "@docusaurus/preset-classic";
const config: Config = {
// *snip*
markdown: {
cjkFriendlyEmphasis: true, // Plan (1)
},
presets: [
[
"classic":
{
cjkFriendlyEmphasis: true, // Plan (2),
// *snip*
} as Options
],
],
// *snip*
};
export default config;
```
Also there are 3 proposed strategies for enabling it:
- opt-out & dependencies
- opt-in & dependencies
- opt-in & optional peerDependencies (users need to run `pnpm add remark-cjk-friendly remark-cjk-friendly-strikethrough`)
### Self-service
- [x] I'd be willing to do some initial work on this proposal myself.
Contributor guide
Assessment
This issue has not been assessed yet.