Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce consistent emphasis / strength style #366

Open
rpdelaney opened this issue Nov 9, 2022 · 1 comment
Open

Enforce consistent emphasis / strength style #366

rpdelaney opened this issue Nov 9, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@rpdelaney
Copy link
Contributor

Context

markdownlint has rules for this:

They seem like good rules and mdformat can do this.

Proposal

Pick a style for emphasis and strength, and have mdformat swap the other to the chosen format.

I don't have a strong opinion about which should win, but if it's a coin-toss then I guess _Italic_ and **Strong** would be easiest for humans to differentiate?

Tasks and updates

No response

@rpdelaney rpdelaney added the enhancement New feature or request label Nov 9, 2022
@hukkin
Copy link
Member

hukkin commented Dec 16, 2022

I think it'd be fine to enforce the _italic_ and **strong** rule you mention. The reason we don't do it is mostly because it can get a bit tricky with things like

  • nested emphases
  • literal * and _ letters within the emphasized text
  • * and _ are used in other CommonMark syntax rules (at least unordered lists, thematic breaks) so it can be necessary to escape the characters or prefer one character over the other (I think)

There may be some corner cases where exceptions to the rule need to be made? These should be carefully thought out.

Reusing the emphasis character from original source was a cheap way to avoid these issues.

A PR is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants