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

[Other]: Update example in TabsCodeBlocks component #1004

Open
amirhhashemi opened this issue Jan 3, 2025 · 0 comments
Open

[Other]: Update example in TabsCodeBlocks component #1004

amirhhashemi opened this issue Jan 3, 2025 · 0 comments
Labels
pending review Awaiting review by team members.

Comments

@amirhhashemi
Copy link
Contributor

amirhhashemi commented Jan 3, 2025

📋 Explain your issue

For some reason, Prettier does not format fenced code blocks inside JSX unless the following conditions are met:

  1. There is a blank line at the top and bottom of the block.
  2. The block starts at the beginning of the line (with no indentation).

For example, Prettier does not recognize the fenced code block in this code:

<TabsCodeBlocks>
  <div id="npm">
    ```bash frame="none"
    npm install @macaron-css/core @macaron-css/solid
    ```
  </div>
</TabsCodeBlocks>

As a result, it formats it incorrectly like this:

<TabsCodeBlocks>
  <div id="npm">
    ```bash frame="none" npm install @macaron-css/core @macaron-css/solid ```
  </div>
</TabsCodeBlocks>

To help prevent this issue, I suggest updating the example from the TabsCodeBlocks component. Change it from:

 * @example
 * // jsx
 * <TabsCodeBlocks>
 *   <div id="npm">
 *     \```bash frame="none"
 *       npm install
 *     \```
 *   </div>
 *   <div id="yarn">
 *     \```bash frame="none"
 *       yarn install
 *     \```
 *   </div>
 *   ...
 * </TabsCodeBlocks>

to something like this:

 * @example
 * // jsx
 * <TabsCodeBlocks>
 * <div id="npm">
 *
 * ```bash frame="none"
 * npm install
 * ```
 *
 * </div>
 * <div id="yarn">
 *
 * ```bash frame="none"
 * yarn install
 * ```
 *
 * </div>
 * ...
 * </TabsCodeBlocks>

It would also be helpful to leave a note about this issue too.

Feel free to assign this task to me if you’d like.

@amirhhashemi amirhhashemi added the pending review Awaiting review by team members. label Jan 3, 2025
@amirhhashemi amirhhashemi changed the title [Other]: [Other]: Update example in TabsCodeBlocks component Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending review Awaiting review by team members.
Projects
None yet
Development

No branches or pull requests

1 participant