Skip to content

Bug: “Ensure CJK and English/number spacing” breaks Markdown emphasis (**...**) and produces PLACEHOLDER artifacts #1420

@YuanChenCheung

Description

@YuanChenCheung
  • I have verified that I am on the latest version of the Linter

Describe the Bug

When the rule "Ensures that Chinese, Japanese, or Korean and English or numbers are separated by a single space (space-between-chinese-japanese-or-korean-and-english-or-numbers)" is enabled, Markdown emphasis syntax using asterisks (* or **) is corrupted — especially when multiple bold sections appear on the same line.

Instead of simply adding spaces between CJK and English text, the Linter breaks Markdown structure, causing duplication of ****, and even injecting raw placeholder strings like NG_PLACEHOLDER} or TRONG_PLACEHOLDER} into the document.

This behavior permanently damages the text after multiple lint runs.

How to Reproduce

Steps to reproduce the behavior:

  1. Open Obsidian with the Linter plugin installed.
  2. Enable the rule:
    Ensures that Chinese, Japanese, or Korean and English or numbers are separated by a single space
  3. Create a note containing multiple bold Markdown segments in one line, such as:
香港的大学体系受英国影响,**教学岗位(Instructor)****学术科研岗位(Professor Track)****两条不同晋升路径**
  1. Run the Linter for more than one time
  2. Observe the corrupted output, such as:
香港的大学体系受英国影响,**教学岗位(Instructor)****学术科研岗位(Professor Track)****两条不同晋升路径******NG_PLACEHOLDER}两条不同晋升路径******NG_PLACEHOLDER}两条不同晋升路径****LACEHOLDER}。

Debug Logs

debug_logs.txt

Expected Behavior

The Linter should not modify Markdown emphasis syntax or insert placeholders.
The following is the expected (correct) output:

香港的大学体系受英国影响,**教学岗位(Instructor)****学术科研岗位(Professor Track)****两条不同晋升路径**

Device

  • Desktop
  • Mobile

Analysis (According to ChatGPT, NOT for sure)

The rule’s regex pattern likely matches asterisks (*) as ASCII characters when identifying CJK–English boundaries.
In lines with multiple Markdown emphasis sections (...), these regex captures split the ** tokens apart.
Linter temporarily replaces matched segments with placeholders (e.g. NG_PLACEHOLDER_1), but the placeholder count and positions no longer align after regex replacements.
When placeholders are restored, some fail to resolve, producing visible artifacts (NG_PLACEHOLDER}, duplicated ****).
Each additional lint pass processes these placeholders again, compounding corruption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions