diff --git a/site/docs/extensions/cjk-friendly-emphasis.md b/site/docs/extensions/cjk-friendly-emphasis.md new file mode 100644 index 00000000..9f73b0f1 --- /dev/null +++ b/site/docs/extensions/cjk-friendly-emphasis.md @@ -0,0 +1,42 @@ +--- +title: CJK friendly emphasis +--- + +# CJK friendly emphasis + +Enable with `.UseCjkFriendlyEmphasis()` (not included in `UseAdvancedExtensions()`). + +This extension adjusts emphasis delimiter rules to better support **Chinese/Japanese/Korean (CJK)** text, where words are commonly written without spaces. It follows the [markdown-cjk-friendly specification](https://github.com/tats-u/markdown-cjk-friendly/) and mitigates the CommonMark emphasis limitation discussed in [commonmark-spec#650](https://github.com/commonmark/commonmark-spec/issues/650). + +## Enable + +```csharp +using Markdig; + +var pipeline = new MarkdownPipelineBuilder() + .UseCjkFriendlyEmphasis() + .Build(); +``` + +You can also enable it via string configuration: + +```csharp +var pipeline = new MarkdownPipelineBuilder() + .Configure("common+cjk-friendly-emphasis") + .Build(); +``` + +## Examples + +Some emphasis sequences that often fail with plain CommonMark in CJK text become parseable with this extension enabled: + +```markdown +**この文を強調できますか?**残念ながらできません。 +我可以强调**这个`code`**吗? +**이 용어(This term)**를 강조해 주세요. +``` + +## Notes + +- This extension intentionally deviates from strict CommonMark emphasis behavior to improve real-world CJK authoring. +- It only affects how emphasis delimiters are interpreted; it does not add new syntax. diff --git a/site/docs/extensions/emphasis-extras.md b/site/docs/extensions/emphasis-extras.md index ad9ae962..8c0ee642 100644 --- a/site/docs/extensions/emphasis-extras.md +++ b/site/docs/extensions/emphasis-extras.md @@ -8,6 +8,8 @@ Enable with `.UseEmphasisExtras()` (included in `UseAdvancedExtensions()`). This extension adds several emphasis styles beyond standard bold and italic. +If you need improved emphasis parsing for Chinese/Japanese/Korean (CJK) text, see [CJK friendly emphasis](cjk-friendly-emphasis.md). + ## Strikethrough Wrap text with `~~` for strikethrough: diff --git a/site/docs/extensions/menu.yml b/site/docs/extensions/menu.yml index 44532379..36a88a59 100644 --- a/site/docs/extensions/menu.yml +++ b/site/docs/extensions/menu.yml @@ -2,6 +2,7 @@ doc: - {path: readme.md, title: " Overview"} - {path: tables.md, title: "Tables"} - {path: emphasis-extras.md, title: "Emphasis extras"} + - {path: cjk-friendly-emphasis.md, title: "CJK friendly emphasis"} - {path: task-lists.md, title: "Task lists"} - {path: mathematics.md, title: "Mathematics"} - {path: alert-blocks.md, title: "Alert blocks"} diff --git a/site/docs/extensions/readme.md b/site/docs/extensions/readme.md index 1fa0a9e0..80ccf966 100644 --- a/site/docs/extensions/readme.md +++ b/site/docs/extensions/readme.md @@ -69,6 +69,7 @@ var pipeline = new MarkdownPipelineBuilder() | [Self pipeline](other.md) | `.UseSelfPipeline()` | Auto-configure pipeline from document | | [Pragma lines](other.md) | `.UsePragmaLines()` | Line number pragma IDs | | [Non-ASCII no escape](other.md) | `.UseNonAsciiNoEscape()` | Disable URI escaping for non-ASCII | +| [CJK friendly emphasis](cjk-friendly-emphasis.md) | `.UseCjkFriendlyEmphasis()` | Improved emphasis delimiter rules for CJK text | ## Extension ordering diff --git a/site/docs/usage.md b/site/docs/usage.md index 1ff27e81..d3e383de 100644 --- a/site/docs/usage.md +++ b/site/docs/usage.md @@ -139,7 +139,7 @@ var pipeline = new MarkdownPipelineBuilder() .Build(); ``` -Available extension tokens: `common`, `advanced`, `alerts`, `pipetables`, `gfm-pipetables`, `emphasisextras`, `listextras`, `hardlinebreak`, `footnotes`, `footers`, `citations`, `attributes`, `gridtables`, `abbreviations`, `emojis`, `definitionlists`, `customcontainers`, `figures`, `mathematics`, `bootstrap`, `medialinks`, `smartypants`, `autoidentifiers`, `tasklists`, `diagrams`, `nofollowlinks`, `noopenerlinks`, `noreferrerlinks`, `nohtml`, `yaml`, `nonascii-noescape`, `autolinks`, `globalization`. +Available extension tokens: `common`, `advanced`, `alerts`, `pipetables`, `gfm-pipetables`, `emphasisextras`, `listextras`, `hardlinebreak`, `footnotes`, `footers`, `citations`, `attributes`, `gridtables`, `abbreviations`, `emojis`, `definitionlists`, `customcontainers`, `figures`, `mathematics`, `bootstrap`, `medialinks`, `smartypants`, `autoidentifiers`, `tasklists`, `diagrams`, `nofollowlinks`, `noopenerlinks`, `noreferrerlinks`, `nohtml`, `yaml`, `nonascii-noescape`, `autolinks`, `globalization`, `cjk-friendly-emphasis`. ## The MarkdownParserContext