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

markdown: Underline incorrectly recognized as italic #16160

Open
njzjz opened this issue Mar 21, 2024 · 4 comments
Open

markdown: Underline incorrectly recognized as italic #16160

njzjz opened this issue Mar 21, 2024 · 4 comments
Labels
lang:markdown Issues affecting Markdown type:bug Issues identifying ugly output, or a defect in the program

Comments

@njzjz
Copy link

njzjz commented Mar 21, 2024

Prettier 3.2.5
Playground link

--parser markdown

Input:

- style\_name = *dplr*
- style\_name = _dplr_
- style_name = _dplr_

Output:

- style_name = _dplr_
- style_name = _dplr_
- style*name = \_dplr*

Expected output:

- style_name = _dplr_
- style_name = _dplr_
- style_name = _dplr_

Why?

Please see how GitHub renders them:

- style\_name = *dplr*
  • style_name = dplr
- style\_name = _dplr_
  • style_name = dplr
- style_name = _dplr_
  • style_name = dplr
- style*name = \_dplr*
  • stylename = _dplr

The first three are equivalent, but the last one is wrong. However, when running prettier multiple times, all first three will finally convert to the last one.

xref: deepmodeling/deepmd-kit@fe17568

@zhuozhiyongde
Copy link

same issue here, it also effect the math format:

$\sum_{j=1}^{p} |\beta_j| $

$\sum_{j=1}^{p} |\beta_j| $

will format as:

$\sum\_{j=1}^{p} |\beta_j| $

$\sum_{j=1}^{p} |\beta_j| $

@VKondakoff
Copy link

Same issue:

nng_pub_open --- create _PUB_ socket

will format as:

nng*pub_open --- create \_PUB* socket

@sosukesuzuki sosukesuzuki added type:bug Issues identifying ugly output, or a defect in the program lang:markdown Issues affecting Markdown labels Apr 6, 2024
yanapeycheva pushed a commit to iuliaaai/prettier that referenced this issue Apr 29, 2024
@yanapeycheva
Copy link

This issue is most probably connected to #15032 and with the pull request 13676

@njzjz
Copy link
Author

njzjz commented Apr 29, 2024

This issue is most probably connected to #15032 and with the pull request 13676

I tried the playground in #13676, and it can give the correct result.

Input:

- style\_name = *dplr*
- style\_name = _dplr_
- style_name = _dplr_
  • style_name = dplr
  • style_name = dplr
  • style_name = dplr

Output:

- style\_name = _dplr_
- style\_name = _dplr_
- style_name = _dplr_
  • style_name = dplr
  • style_name = dplr
  • style_name = dplr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang:markdown Issues affecting Markdown type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

No branches or pull requests

5 participants