Skip to content

Markdown parsing error: bold syntax ** fails when preceded by a closing parenthesis ) #129

@Lu-ZYan

Description

@Lu-ZYan

Short description
When bold syntax **text** is immediately preceded by a closing parenthesis ) (e.g., in scenarios where stock tickers are displayed in parentheses), flutter_markdown_plus fails to parse the bold formatting correctly. The text is rendered as plain text instead of bold.

Example code

final markdown = '''
For example, "fast food giant **McDonald's Corporation(NYSE: MCD)** and **Restaurant Brands International(NYSE: QSR)** front"
''';

MarkdownPlus(data: markdown);

Expected behavior
Both "McDonald's Corporation (NYSE: MCD)" and "Restaurant Brands International (NYSE: QSR)" should be displayed in bold.

Actual behavior
The bold formatting is not applied; the text is rendered as plain text. This appears to be caused by the ) character immediately before the ** delimiter, which may interfere with the markdown parser's boundary detection.

Environment

  • Flutter version: 3.35.1
  • flutter_markdown_plus version: ^1.0.7
  • Platform: iOS / Android / Web (tested on all)

Additional context
When the ) before ** is removed or replaced with another character, the bold formatting works as expected. This suggests the parser may not correctly handle special characters adjacent to markdown syntax delimiters.

Steps to reproduce

  1. Create a markdown string with the pattern )**bold text**;
  2. Render it using the MarkdownPlus widget;
  3. Observe that the bold styling is not applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions