Skip to content

Add opt-in Discord-style __underline__ rendering#10

Closed
PiotrCzapla wants to merge 1 commit into
mainfrom
claude/discord-underline
Closed

Add opt-in Discord-style __underline__ rendering#10
PiotrCzapla wants to merge 1 commit into
mainfrom
claude/discord-underline

Conversation

@PiotrCzapla

@PiotrCzapla PiotrCzapla commented Jul 5, 2026

Copy link
Copy Markdown

New underline option (off by default). When enabled, Discord-style __x__ renders as <u>x</u> instead of <strong>x</strong>:

to_xhtml("__important__", underline=True)   # <p><u>important</u></p>

With underline=True (Python kwarg, --underline CLI flag, or
Options::underline), __x__ renders as <u>x</u> instead of
<strong>x</strong>, following Discord's convention. All the usual
underscore emphasis rules apply: no intraword matching, ___x___
nests as <em><u>x</u></em>, and empty-attr nesting flattens like
strong. **x** is unaffected, and the default stays CommonMark
strong, so conformance is unchanged. Callbacks get a new
"underline" inline kind.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jph00

jph00 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

I'm open to this, although my preference would be to use ++ instead, since that's a known markdown-it extension and doesn't require a new option. Other possibilities that work now are [x]{.underline} (Pandoc's HTML writer special-cases that class and emits <u>) or just Raw <u>x</u>

WDYT?

@PiotrCzapla

Copy link
Copy Markdown
Author

I played with this yesterday using our offer letter template, and I would leave it as it is, the __ does not add much value.

The .underline class was a better fit for places where underlining was used in the offer letter. It was used as a mini-header:

The proposal looks okay:

__Confidential Information__. The Employee understands and acknowledges that, 

But we would likely want to add an ID to that text, which makes this markup a bit too exotic:

__Confidential Information__{#cinfo}. The Employee understands and acknowledges that, 

Using Pandoc's []{.underline} feels better:

[Confidential Information.]{#cinfo .underline} The Employee understands and acknowledges that, 

Or, we could use headers and simply add the style in the DOCX file:

#####  Confidential Information. {#cinfo}
The Employee understands and acknowledges that, 

Regarding Markdown-it, I wasn't aware that ++ means underline; it looks more like <ins>.

I would close this unless you feel that it would be a good addition.

@jph00

jph00 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Heh you're right, ++ means insertion, but it's displayed as underline. :) I'll close this since I don't feel strongly either way, but if you ever decide you do want this after all, I'd need minimal convincing to add it.

@jph00 jph00 closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants