Skip to content

Bug: Bold text (**text**) not parsed when immediately followed by quotation marks #39

@kyle-ingka

Description

@kyle-ingka

Bug Description

When using ** bold markers immediately followed by quotation marks (both straight " and curly "), the markdown parser fails to recognize the bold syntax.

Test Case

Input markdown:

效果**如何**?

我发现**"黑体"**展示不准确。

我发现**"黑体"**展示不准确。

我发现"**黑体**"展示不准确。

Expected Output

All four cases should render with bold text:

  • 效果**如何**?<strong>如何</strong>
  • **"黑体"**<strong>"黑体"</strong> ❌ (actual: **"黑体"**)
  • **"黑体"**<strong>"黑体"</strong> ❌ (actual: **"黑体"**)
  • "**黑体**"<strong>黑体</strong>

Actual Output

<p>效果<strong>如何</strong></p>
<p>我发现**"黑体"**展示不准确。</p>
<p>我发现**"黑体"**展示不准确。</p>
<p>我发现"<strong>黑体</strong>"展示不准确。</p>

Root Cause

This is a limitation of the marked.js library used by wenyan. The parser requires certain boundary characters around the ** delimiters to recognize them as emphasis markers. When ** is immediately followed by a quotation mark, the parser doesn't recognize it as a valid emphasis boundary.

Environment

  • wenyan-cli version: (current)
  • Node.js version: N/A
  • OS: macOS

Possible Solutions

  1. Configure marked.js to be more permissive with emphasis boundaries
  2. Add a preprocessing step to handle this edge case
  3. Document this limitation and recommend users write "**text**" instead of **"text"**

Reference

  • Test file used: /tmp/wenyan-theme-normal.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions