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 · 3 comments
Open

[Other]: Update example in TabsCodeBlocks component #1004

amirhhashemi opened this issue Jan 3, 2025 · 3 comments
Labels
planned Features or content that are planned but not yet in progress. site improvement Something that improves the website functionality

Comments

@amirhhashemi
Copy link
Collaborator

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
@LadyBluenotes
Copy link
Member

@atilafassina when you get a chance, could you please review this / provide feedback?

@LadyBluenotes
Copy link
Member

I believe this might get addressed with #998 ? Please confirm!

@amirhhashemi
Copy link
Collaborator Author

@LadyBluenotes No. That PR addresses issues in the existing content, but if anyone wants to use <TabsCodeBlocks> for new content, I believe an updated example would be helpful.

@LadyBluenotes LadyBluenotes added site improvement Something that improves the website functionality planned Features or content that are planned but not yet in progress. and removed pending review Awaiting review by team members. labels Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planned Features or content that are planned but not yet in progress. site improvement Something that improves the website functionality
Projects
None yet
Development

No branches or pull requests

3 participants