4 backslashes are rendered as just 1 #622

Open
opened 2026-01-29 14:41:24 +00:00 by claunia · 0 comments
Owner

Originally created by @jansokoly on GitHub (Aug 29, 2023).

Is there an explanation for why does Markdown.ToHtml("\\\\contoso.com") output \contoso.com? I would expect it to output 2 backslashes, i.e. \\contoso.com.

A workaround seems to be using 6 backslashes Markdown.ToHtml("\\\\\\contoso.com") to get 2 at output, but I'm trying to understand the logic here and can't find an answer.

Executable snippet: https://dotnetfiddle.net/XVxnyQ

With commonmark.js dingus, 4 backslashes result in 2 at output, as predicted:

image

Markdig 0.32.0.

Thank you.

Originally created by @jansokoly on GitHub (Aug 29, 2023). Is there an explanation for why does `Markdown.ToHtml("\\\\contoso.com")` output `\contoso.com`? I would expect it to output 2 backslashes, i.e. `\\contoso.com`. A workaround seems to be using 6 backslashes `Markdown.ToHtml("\\\\\\contoso.com")` to get 2 at output, but I'm trying to understand the logic here and can't find an answer. Executable snippet: https://dotnetfiddle.net/XVxnyQ With [commonmark.js dingus](https://spec.commonmark.org/dingus/), 4 backslashes result in 2 at output, as predicted: ![image](https://github.com/xoofx/markdig/assets/69093/3275c3a8-492e-4aa8-922d-234c3dfb413a) Markdig 0.32.0. Thank you.
claunia added the question label 2026-01-29 14:41:24 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#622