Skip to content

Commit

Permalink
docs: mention admonition quirks with Prettier (#6135)
Browse files Browse the repository at this point in the history
* docs: mention admonition quirks with Prettier

* Update markdown-features-admonitions.mdx

* Update markdown-features-admonitions.mdx

* Update markdown-features-admonitions.mdx
  • Loading branch information
yangshun authored Dec 20, 2021
1 parent c0a9978 commit faef753
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@ Some **content** with _markdown_ `syntax`. Check [this `api`](#).

:::

## Usage with Prettier {#usage-with-prettier}

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.

<!-- prettier-ignore -->
```md
<!-- Prettier doesn't change this -->
::: note

Hello world

:::

<!-- Prettier changes this -->
::: note
Hello world
:::

<!-- to this -->
::: note Hello world:::
```

## Specifying title {#specifying-title}

You may also specify an optional title
Expand Down

0 comments on commit faef753

Please sign in to comment.