Skip to content

[Other]: Update example in TabsCodeBlocks component #1004

Closed
@amirhhashemi

Description

@amirhhashemi

📋 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plannedFeatures or content that are planned but not yet in progress.site improvementSomething that improves the website functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions