mirror of
https://github.com/xoofx/markdig.git
synced 2026-11-16 09:20:40 +00:00
docs(site): document CJK friendly emphasis extension
This commit is contained in:
42
site/docs/extensions/cjk-friendly-emphasis.md
Normal file
42
site/docs/extensions/cjk-friendly-emphasis.md
Normal file
@@ -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.
|
||||
@@ -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:
|
||||
|
||||
@@ -2,6 +2,7 @@ doc:
|
||||
- {path: readme.md, title: "<i class='bi bi-puzzle' aria-hidden='true'></i> 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"}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user