Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: Preserve multiple spaces in inline code #13590
Markdown: Preserve multiple spaces in inline code #13590
Changes from 12 commits
f94f5a8
c32ebba
afd962e
15aee10
d5fdb2c
e0f2ed2
8d23538
4fc4693
dbe851d
6af20a1
feee9dd
17f18ad
9a7cd17
e2abead
5c7d4e1
6489a4d
c5677d0
0856e6a
0b42cdf
f939b6d
33d7a43
5350af8
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something doesn't look right here. Is this part really needed? Isn't this check and processing done by the parser already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I see why you did this. But this should be done in
print
, not inpreprocess
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for the fix! 🙌
Do you know why we still need
newObj.value = ast.value.replace(/\n/g, " ");
inclean.js
? This transform is applied regardless ofproseWrap
. I vaguely remember trying to remove it but tests failed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those tests are run only with
proseWrap: "always"
, that's why it works. Need to think what to do.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was wrong. It's some other tests that fail if I add
to
jsfmt.spec.js
, not related to code spans.As for
clean.js
, see how theclean
function (AKAmassageAST
) is used:prettier/src/cli/format.js
Lines 137 to 169 in 955553b
It's applied to both the original AST and to the AST built from Prettier's output, and then the ASTs are checked for deep equality. So it makes sense that this replacement is needed. After it, no matter what
proseWrap
is, the values in the two ASTs are equal.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this call
markdown -> js -> css
and remove the leading space? Because it's not valid css?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a crazy test.
const cssString = ...
is Markdown here, not JS. The Markdown-in-JS embedder also includes logic for ignoring indentation (no idea what's the story behind that). That's why the output is like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you explained before... forgot. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context: #13591