Feature #43234
openEnable CJK-friendly emphasis extension for CommonMark
0%
Description
This patch enables the CJK-friendly emphasis extension in commonmarker to properly parse Markdown emphasis (**
) with CJK (Chinese, Japanese, Korean) characters. This resolves a known issue where emphasis marks were not correctly interpreted when adjacent to CJK characters, such as in **テスト。**テスト
.
Input:
Before:
After:
I believe this will help improve the user experience for CJK language users.
According to the documentation for the package that this extension is based on, enabling it does not affect languages other than CJK.
This modification of the specification does not affect the other languages than Chinese, Japanese, and Korean. Even if your application or document has translations or content in other languages, it will not be affected
I have also verified its functionality with English, Spanish, and French, and found no issues. All tests have passed with this patch.
https://github.com/hidakatsuya/redmine/actions/runs/17896214845
diff --git a/Gemfile b/Gemfile
index 9cde32ec8..add1363f7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,7 +18,7 @@ gem 'propshaft', '~> 1.1.0'
gem 'rack', '>= 3.1.3'
gem "stimulus-rails", "~> 1.3"
gem "importmap-rails", "~> 2.0"
-gem 'commonmarker', '~> 2.3.0'
+gem 'commonmarker', '~> 2.3.2'
gem "doorkeeper", "~> 5.8.2"
gem "bcrypt", require: false
gem "doorkeeper-i18n", "~> 5.2"
diff --git a/lib/redmine/wiki_formatting/common_mark/formatter.rb b/lib/redmine/wiki_formatting/common_mark/formatter.rb
index 8b7a18394..2b5f3f163 100644
--- a/lib/redmine/wiki_formatting/common_mark/formatter.rb
+++ b/lib/redmine/wiki_formatting/common_mark/formatter.rb
@@ -35,6 +35,7 @@ module Redmine
tasklist: true,
shortcodes: false,
alerts: true,
+ cjk_friendly_emphasis: true,
}.freeze,
# https://github.com/gjtorikian/commonmarker#parse-options
Files
Updated by Marius BĂLTEANU about 6 hours ago
Thanks! Can you add a test, please?
Updated by Marius BĂLTEANU about 6 hours ago
- Target version set to Candidate for next minor release
Updated by Katsuya HIDAKA about 4 hours ago
Sure, I missed adding a test. I'll add it.