Skip to content
PluginStats

prettier-plugin-mp weekly downloads statistics

By CornWorld · npm · Prettier plugins

Prettier plugin for WeChat Mini Program WXML files

View on npm Fresh · Dec 6, 2026

prettier-plugin-mp has 37 recorded weekly downloads on npm, an increase of 19.4% over the past 30 days, ranking #2842 of 3,247 tracked listings.

Weekly downloads
37
Official API · Dec 5, 2026
7-day growth
+60.9%
+14 weekly downloads
30-day growth
+19.4%
+6 weekly downloads
90-day growth
+19.4%
+6 weekly downloads
Rank
#2842
▼ 73 in 7 days

About prettier-plugin-mp

prettier-plugin-mp

微信小程序 WXML 和 WXS 文件的 Prettier 格式化插件。

A Prettier plugin for formatting WeChat Mini Program WXML and WXS files with professional code quality.

特性 Features

✅ WXML 格式化: 为 WXML 文件提供正确的缩进和结构
✅ WXS JavaScript 格式化: 为嵌入的 WXS 模块提供完整的 JavaScript 格式化
✅ 可配置选项: 为 WXML 和 WXS 提供独立的格式化选项
✅ 微信语法支持: 完整支持 wx:for、wx:if 和其他微信指令
✅ 专业品质: 基于官方 Prettier XML 插件架构

安装 Installation

pnpm install -D prettier-plugin-mp
# 或者 or
npm install --save-dev prettier-plugin-mp

使用方法 Usage

基本使用 Basic Usage
命令行 Command Line
# 格式化所有 WXML 文件 Format all WXML files
prettier --plugin=prettier-plugin-mp --write "**/*.wxml"

# 格式化指定文件 Format specific file
prettier --plugin=prettier-plugin-mp --write src/pages/index.wxml
Configuration File

Create a .prettierrc file:

{
  "plugins": ["prettier-plugin-mp"],
  "overrides": [
    {
      "files": "*.wxml",
      "options": {
        "parser": "wxml"
      }
    }
  ]
}

配置选项 Configuration Options

你可以通过在 .prettierrc 文件中添加这些选项来自定义格式化行为:

You can customize the formatting behavior by adding these options to your .prettierrc file:

WXML 选项 WXML Options
选项 Option类型 Type默认值 Default描述 Description
wxmlTabWidthint2WXML 缩进空格数(当前版本暂不生效;请使用 Prettier 的标准 tabWidth) Number of spaces per indentation level for WXML (currently ignored; use Prettier tabWidth)
wxmlPrintWidthint80WXML 换行长度 Line length where Prettier will try to wrap for WXML
wxmlSingleQuotebooleanfalseWXML 属性使用单引号 Use single quotes in WXML attributes
wxmlPreferBreakTagsstring""逗号分隔的标签名集合,强制其子元素换行,例如:wxs,template,button Comma-separated tag names to force breaking children, e.g., wxs,template,button
WXS 选项 WXS Options
选项 Option类型 Type默认值 Default描述 Description
wxsTabWidthint2WXS 代码缩进空格数 Number of spaces per indentation level for WXS code
wxsSingleQuotebooleantrueWXS 代码使用单引号 Use single quotes in WXS code
wxsSemibooleantrueWXS 语句末尾添加分号 Print semicolons at the ends of statements in WXS code
wxsBabelParserOptions`objectstring`{}
wxsBabelGeneratorOptions`objectstring`{}

说明 Note: wxsPrintWidth 目前不受支持,任何配置都会被忽略。Use of wxsPrintWidth is currently not supported and will be ignored.

配置示例 Example Configuration
{
  "plugins": ["prettier-plugin-mp"],
  "overrides": [
    {
      "files": "*.wxml",
      "options": {
        "parser": "wxml",
        "wxmlTabWidth": 2,
        "wxmlPrintWidth": 100,
        "wxmlSingleQuote": false,
        "wxmlPreferBreakTags": "wxs,template,button",
        "wxsTabWidth": 2,
        "wxsSingleQuote": true,
        "wxsSemi": true
      }
    }
  ]
}

示例 Examples

格式化前 Before Formatting
<view><text>Hello</text><wxs module="test">var a=1;function test(){return a;}</wxs></view>
格式化后 After Formatting
<view>
  <text>Hello</text>
  <wxs module="test">
  var a = 1;
  function test() {
    return a;
  }
  </wxs>
</view>

支持的语法 Supported Syntax

  • WXML 元素: 所有标准 WXML 标签和属性 All standard WXML tags and attributes
  • 微信指令: wx:for, wx:if, wx:elif, wx:else, wx:key 等 WeChat Directives
  • 数据绑定: {{ }} 表达式 Data Binding expressions
  • WXS 模块: <wxs> 标签内的完整 JavaScript 语法 Complete JavaScript syntax within <wxs> tags
  • 事件处理: bind:tap, catch:tap 等 Event Handlers
  • 自闭合标签: <image />, <input /> 等的正确格式化 Proper formatting for self-closing tags

开发 Development

# 克隆仓库 Clone the repository
git clone https://github.com/your-username/prettier-plugin-mp.git
cd prettier-plugin-mp

# 安装依赖 Install dependencies
pnpm install
# 或者 or
npm install

# 运行测试 Run tests
npm test

# 测试格式化 Test formatting
npm run format:wxml

许可证 License

MIT

Description from the npm listing.

  • prettier
  • plugin
  • wechat
  • miniprogram
  • wxml
  • wxs
  • formatter
  • prettier-plugin
  • wechat-miniprogram
  • wxml-formatter
  • prettier-plugin-wxml

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

prettier-plugin-mp weekly downloads on npm, last 90 days: 37 weekly downloads as of Dec 5, 2026, +19.4% over 90 days.prettier-plugin-mpWeekly downloads on npm · Last 90 days37downloads / week+19.4% over 90 days0102030405060Sep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
prettier-plugin-mp weekly downloads on npm, last 90 days: 37 weekly downloads as of Dec 5, 2026, +19.4% over 90 days.

7/30/90-day growth

prettier-plugin-mp weekly downloads growth on npm: +60.9% over 7 days, +19.4% over 30 days, +19.4% over 90 days.prettier-plugin-mpWeekly downloads growth on npm37downloads / week now7-day growth+14 weekly downloads+60.9%30-day growth+6 weekly downloads+19.4%90-day growth+6 weekly downloads+19.4%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
prettier-plugin-mp weekly downloads growth on npm: +60.9% over 7 days, +19.4% over 30 days, +19.4% over 90 days.

Ranking history

prettier-plugin-mp npm ranking history: currently #2842 (by weekly downloads).prettier-plugin-mpnpm ranking · by weekly downloads · Last 90 days#2842current rank#1800#2000#2200#2400#2600#2800#3000Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 18, 2026 – Dec 6, 2026 · 44 observations · Updated Dec 5, 2026pluginstats.com
prettier-plugin-mp npm ranking history: currently #2842 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 143, #4 (overall #2,844)
All npm: every listing in weekly downloads order

Listing placement

Prettier plugins267 listings · 14 pages · page 7, #13 (overall #133)
Prettier plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (157)
Recent weekly downloads observations for prettier-plugin-mp
Date (UTC)Weekly downloadsChange vs. previous
37+2
35+1
34+23
110
11+2
9-1
10-13
23-2
25+2
23+3
20-2
22-1
23-2
25—

Similar npm Prettier plugins plugins

All 20 prettier-plugin-mp alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/prettier-plugin-mp. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.