diff --git a/docs/browser.md b/docs/browser.md index c6c56bf46..47519a327 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -18,7 +18,7 @@ Required options: - **[`parser`](options.md#parser) (or [`filepath`](options.md#file-path))**: One of these options has to be specified for Prettier to know which parser to use. -- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in +- **`plugins`**: Unlike the `format` function from the [Node.js-based API](api.md#prettierformatsource--options), this function doesn’t load plugins automatically. The `plugins` option is required because all the parsers included in the Prettier package come as plugins (for reasons of file size). These plugins are files in . Note that `estree` plugin should be loaded when printing JavaScript, TypeScript, Flow, or JSON. You need to load the ones that you’re going to use and pass them to `prettier.format` using the `plugins` option. @@ -48,11 +48,11 @@ Note that the [`unpkg` field](https://unpkg.com/#examples) in Prettier’s `pack ```html ``` @@ -76,6 +76,7 @@ define([ ```js const prettier = require("prettier/standalone"); const plugins = [require("prettier/plugins/graphql")]; + (async () => { const formatted = await prettier.format("type Query { hello: String }", { parser: "graphql", @@ -91,6 +92,7 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b ```js importScripts("https://unpkg.com/prettier@3.0.0/standalone.js"); importScripts("https://unpkg.com/prettier@3.0.0/plugins/graphql.js"); + (async () => { const formatted = await prettier.format("type Query { hello: String }", { parser: "graphql", @@ -106,12 +108,13 @@ If you want to format [embedded code](options.md#embedded-language-formatting), ```html ``` @@ -77,6 +77,7 @@ define([ ```js const prettier = require("prettier/standalone"); const plugins = [require("prettier/plugins/graphql")]; + (async () => { const formatted = await prettier.format("type Query { hello: String }", { parser: "graphql", @@ -92,6 +93,7 @@ This syntax doesn’t necessarily work in the browser, but it can be used when b ```js importScripts("https://unpkg.com/prettier@3.0.0/standalone.js"); importScripts("https://unpkg.com/prettier@3.0.0/plugins/graphql.js"); + (async () => { const formatted = await prettier.format("type Query { hello: String }", { parser: "graphql", @@ -107,12 +109,13 @@ If you want to format [embedded code](options.md#embedded-language-formatting), ```html