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: Link text converted to lower-case #3835

Closed
IvanGoncharov opened this issue Jan 28, 2018 · 7 comments · Fixed by #13155
Closed

Markdown: Link text converted to lower-case #3835

IvanGoncharov opened this issue Jan 28, 2018 · 7 comments · Fixed by #13155
Labels
lang:markdown Issues affecting Markdown locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency type:bug Issues identifying ugly output, or a defect in the program

Comments

@IvanGoncharov
Copy link

Prettier 1.10.2
Playground link

--parser markdown

Input:

[1][Test Text](http://example.com)

Output:

[1][test text](http://example.com)

Expected behavior:

[1][Test Text](http://example.com)
@lydell
Copy link
Member

lydell commented Jan 28, 2018

Hi! I’m curious, what do those examples even mean? I’ve seen [link test](href) and [link text][ref] but not the combination of those.

@IvanGoncharov
Copy link
Author

@lydell [1] is literal part and the whole sample rendered as:
[1]Test Text

Real-life use case from here: https://github.com/facebook/graphql/blob/master/rfcs/Subscriptions.md
image

@lydell
Copy link
Member

lydell commented Jan 28, 2018

Thanks! As a workaround, I believe you can add a \ at the beginning: \[1][Test Text](http://example.com).

I think what’s happening is that Prettier thinks that [1][Test Text] is the link (where it is valid to lowercase the ref) and that it is followed by some text in parentheses. I don’t know which is correct according to the CommonMark spec, though. Hopefully @ikatyang knows :)

@IvanGoncharov
Copy link
Author

IvanGoncharov commented Jan 28, 2018

I don’t know which is correct according to the CommonMark spec, though.

@lydell It looks like CommonMark has the exact same behavior as GFM:
http://spec.commonmark.org/dingus/?text=%5B1%5D%5BTest%20Text%5D(http%3A%2F%2Fexample.com)

@ikatyang
Copy link
Member

This is caused by remark mis-parsing, opened remarkjs/remark#324.

@ikatyang ikatyang added type:bug Issues identifying ugly output, or a defect in the program priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency lang:markdown Issues affecting Markdown labels Jan 29, 2018
@rekmarks
Copy link

rekmarks commented May 4, 2021

This is fixed by remark as of October 13, 2020, however it's coupled with a major release of all remark packages used by Prettier. Updating those packages seems like a job for someone pretty intimately familiar with unified, remark, and possibly micromark.

@TrevorBurnham
Copy link

I've created an issue to track the task of upgrading Prettier to remark-parse@9: #11828

ssbarnea added a commit to ssbarnea/ansible-language-server that referenced this issue Jan 20, 2022
Ensures that all our references keys are using lowercase in order
to workaround known prettier bug.

Related: prettier/prettier#3835
Required-By: ansible#177
ssbarnea added a commit to ssbarnea/ansible-language-server that referenced this issue Jan 20, 2022
Ensures that all our references keys are using lowercase in order
to workaround known prettier bug.

Related: prettier/prettier#3835
Required-By: ansible#177
@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Nov 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:markdown Issues affecting Markdown locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. priority:high Code is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent! scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants