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

feat: add prettier for content folder #1754

Merged
merged 22 commits into from
Jun 14, 2024
Merged

feat: add prettier for content folder #1754

merged 22 commits into from
Jun 14, 2024

Conversation

saimonkat
Copy link
Collaborator

@saimonkat saimonkat commented May 30, 2024

Description

This PR adds prettier config for content folder

Problems

Commets sctructure

Before

To comment out content in a markdown file we used JSX-style comments

{/* 

content

*/}

This approach had a problem that we could see the commented code in the markdown preview, but allowed us to comment huge complicated blocks of code.

After

Unfortunately, Prettier escapes asterisks and formats JSX comments from {/* ... */} to {/\* ... \*/}.
It looks bad, provides build and eslint errors, and there is nothing we can do about it.

So now we're changing to the new comments structure:

[comment]: <> (This is a single line comment.)

[comment]: <> (
This is a multiline comment.
You can't use line breaks here.
You should escape the () brackets with a \ backslash.
)

This new approach allows to hide the commented code from the markdown preview, but has a big problem that we can't comment complicated blocks of codes.

We still can use JSX-style comments for the complicated blocks of codes, but in this case we should add the whole file to prettier ignore list at .prettierignore

Updated contribution guide

Steps to test

References
Preview

Copy link

vercel bot commented May 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
neon-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2024 9:16pm

@saimonkat saimonkat marked this pull request as draft May 30, 2024 16:06
@rishi-raj-jain
Copy link
Contributor

@saimonkat

I see that you requested my review on this.

Is the PR ready and no longer in draft mode?

@saimonkat
Copy link
Collaborator Author

Hi @rishi-raj-jain I just wanted you to take a look at this and hear you thoughts about comments issue, I described in description 🙏🏻

@saimonkat saimonkat merged commit 803c387 into main Jun 14, 2024
3 checks passed
@saimonkat saimonkat deleted the content-prettier branch June 14, 2024 07:54
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.

4 participants