From ac67a74118e5230e8a05a5053fc49658ba109381 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 20 Aug 2026 11:14:51 +0800 Subject: [PATCH] docs: document rs fmt supported languages --- scripts/dictionary.txt | 1 + website/docs/en/guide/formatting.mdx | 13 +++++++++++++ website/docs/zh/guide/formatting.mdx | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/scripts/dictionary.txt b/scripts/dictionary.txt index 06b17167..94838215 100644 --- a/scripts/dictionary.txt +++ b/scripts/dictionary.txt @@ -12,6 +12,7 @@ huskyrc indentable jsonline llms +MJML napi noformat noprettier diff --git a/website/docs/en/guide/formatting.mdx b/website/docs/en/guide/formatting.mdx index c1c3a1ce..d77d469d 100644 --- a/website/docs/en/guide/formatting.mdx +++ b/website/docs/en/guide/formatting.mdx @@ -54,6 +54,19 @@ In addition to Prettier options and `overrides`, Rstack CLI provides two options ::: +## Supported languages + +`rs fmt` supports the same built-in languages as [Prettier](https://prettier.io/docs/) and normally infers the language from the file name: + +- [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript), [JSX](https://react.github.io/jsx/), [Flow](https://flow.org/), and [TypeScript](https://www.typescriptlang.org/) +- [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS), [Less](https://lesscss.org/), and [SCSS](https://sass-lang.com/) +- [HTML](https://en.wikipedia.org/wiki/HTML), [Angular](https://angular.dev/), [Vue](https://vuejs.org/), [Ember/Handlebars](https://emberjs.com/), [Lightning Web Components (LWC)](https://developer.salesforce.com/developer-centers/lightning-web-components), and [MJML](https://mjml.io/) +- [JSON](https://json.org/) and [YAML](https://yaml.org/) +- [GraphQL](https://graphql.org/) +- [Markdown](https://commonmark.org/), including [GFM](https://github.github.com/gfm/) and [MDX v1](https://mdxjs.com/) + +You can add support for other languages with [Prettier plugins](#prettier-plugins). + ## Formatting scope `rs fmt` determines the formatting scope from the paths passed on the command line. You can combine the following inputs: diff --git a/website/docs/zh/guide/formatting.mdx b/website/docs/zh/guide/formatting.mdx index 157bd54c..31a6cd19 100644 --- a/website/docs/zh/guide/formatting.mdx +++ b/website/docs/zh/guide/formatting.mdx @@ -54,6 +54,19 @@ define.fmt({ ::: +## 支持的语言 \{#supported-languages} + +`rs fmt` 支持与 [Prettier](https://prettier.io/docs/) 相同的内置语言,通常会根据文件名自动推断语言: + +- [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)、[JSX](https://react.github.io/jsx/)、[Flow](https://flow.org/) 和 [TypeScript](https://www.typescriptlang.org/) +- [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS)、[Less](https://lesscss.org/) 和 [SCSS](https://sass-lang.com/) +- [HTML](https://en.wikipedia.org/wiki/HTML)、[Angular](https://angular.dev/)、[Vue](https://vuejs.org/)、[Ember/Handlebars](https://emberjs.com/)、[Lightning Web Components(LWC)](https://developer.salesforce.com/developer-centers/lightning-web-components) 和 [MJML](https://mjml.io/) +- [JSON](https://json.org/) 和 [YAML](https://yaml.org/) +- [GraphQL](https://graphql.org/) +- [Markdown](https://commonmark.org/),包括 [GFM](https://github.github.com/gfm/) 和 [MDX v1](https://mdxjs.com/) + +你可以通过 [Prettier 插件](#prettier-plugins)支持其他语言。 + ## 格式化范围 \{#formatting-scope} `rs fmt` 根据命令行中传入的路径确定格式化范围。以下输入可以组合使用: