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

docs: mention admonition quirks with Prettier #6135

Merged
merged 4 commits into from
Dec 20, 2021

Conversation

yangshun
Copy link
Contributor

Motivation

Some people at Meta were confused when they ran Prettier on their Markdown files and Prettier messed up their admonition syntax.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Netlify preview

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Dec 20, 2021
@@ -69,6 +69,27 @@ Some **content** with _markdown_ `syntax`. Check [this `api`](#).

:::

## Usage with Prettier
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have used an admonition to relay this message but there are already so many example admonitions on this page people probably won't notice a non-example

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's hard🤦‍♂️Maybe we should wrap the demo admonitions in <BrowserWindow> instead? But the current solution looks fine

@netlify
Copy link

netlify bot commented Dec 20, 2021

✔️ [V2]

🔨 Explore the source changes: 21aa712

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61c000e5acd7800008ba420e

😎 Browse the preview: https://deploy-preview-6135--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Dec 20, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 87
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-6135--docusaurus-2.netlify.app/

@@ -69,6 +69,27 @@ Some **content** with _markdown_ `syntax`. Check [this `api`](#).

:::

## Usage with Prettier

If you use [Prettier](https://prettier.io) to format your Markdown files, Prettier might autoformatting your code which results in invalid the admonition syntax. To avoid this problem, add empty lines around your content. This is also why the examples we show here all have empty lines around the content.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you use [Prettier](https://prettier.io) to format your Markdown files, Prettier might autoformatting your code which results in invalid the admonition syntax. To avoid this problem, add empty lines around your content. This is also why the examples we show here all have empty lines around the content.
If you use [Prettier](https://prettier.io) to format your Markdown files, Prettier might autoformat your code to invalid admonition syntax. To avoid this problem, add empty lines around the starting and ending directives. This is also why the examples we show here all have empty lines around the content.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I should have proofread it 🤦🏻

@Josh-Cena
Copy link
Collaborator

Also I guess you would need prettier-ignore around that code block

@Josh-Cena Josh-Cena added the pr: documentation This PR works on the website or other text documents in the repo. label Dec 20, 2021
Copy link
Collaborator

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Good to merge whenever you feel ready

@Josh-Cena Josh-Cena merged commit faef753 into main Dec 20, 2021
@Josh-Cena Josh-Cena deleted the yangshun/admonitions-quirks branch December 20, 2021 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: documentation This PR works on the website or other text documents in the repo.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants