Tcl Library Source Code

View Ticket
Login
Ticket UUID: a028a78b5b7e6ed561c137283517375eca54611b
Title: Backslashes inside emphasis disable emphasis
Type: Bug Version: 1.2.4
Submitter: apnadkarni Created on: 2026-01-24 09:27:54
Subsystem: markdown Assigned To:
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-01-30 02:03:14
Resolution: None Closed By: nobody
    Closed on:
Description:
For example, compare the two outputs below

```
% Markdown::convert *a/b*
<p><em>a/b</em></p>
% Markdown::convert *a\\b*
<p>*a\b*</p>
```

Or, as per cmark, the output should resemble

```
D:\src\ruff\doc>cmark-gfm
*a\b*
^Z
<p><em>a\b</em></p>
```
User Comments: torstenberg added on 2026-01-30 02:03:14:

There's a branch now for this bug: bug-markdown-a028a78b5b7e

My initial solution was ok but additional tests (added to try other backslash combinations as well) show that the problem is more fundamental. Perhaps, this cannot be solved by having just one regexp. Also, this regexp is so complex, it makes finding a solution much harder ...


torstenberg added on 2026-01-29 15:44:26:

The problem is the regexp in line 653 of markdown.tcl. I am adding some more test since other escape sequences also fail, such as

test basic-1.8 "emphasis with backslash" -body {Markdown::convert "*a\\b\**"} -result {<p><em>a\b*</em></p>}

The regexp is fairly complex so his required some more thinking from my side, but I already have a solution for the original problem and the one in this message ...


torstenberg added on 2026-01-29 15:44:25:

The problem is the regexp in line 653 of markdown.tcl. I am adding some more test since other escape sequences also fail, such as

test basic-1.8 "emphasis with backslash" -body {Markdown::convert "*a\\b\**"} -result {<p><em>a\b*</em></p>}

The regexp is fairly complex so his required some more thinking from my side, but I already have a solution for the original problem and the one in this message ...