Add @prettier/sync to docs (#15977)

This commit is contained in:
fisker Cheung authored and GitHub committed 2024-01-28 16:31:36 +08:00
1 parent a9b2e0f312
commit 09024bac75
1 file changed
+2
+2
View File
@@ -9,6 +9,8 @@ If you want to run Prettier programmatically, check this page out.
import * as prettier from "prettier";
```
Our public APIs are all asynchronous, if you must use synchronous version for some reason, you can try [`@prettier/sync`](https://github.com/prettier/prettier-synchronized).
## `prettier.format(source, options)`
`format` is used to format text using Prettier. `options.parser` must be set according to the language you are formatting (see the [list of available parsers](options.md#parser)). Alternatively, `options.filepath` can be specified for Prettier to infer the parser from the file extension. Other [options](options.md) may be provided to override the defaults.