欢迎回来

登录 EAKE AI,继续您的智能之旅

忘记密码?
还没有账号?立即注册

代码格式化 — 代码美化

2026-07-24 · 未分类

代码格式化 — 代码美化

自动格式化和美化代码。支持多种编程语言,集成 Prettier/ESLint 等格式化工具。

code-formatter

code format

  • support landscaping and compressing code

js/html/css/json/xml/sql

usage

import formatter from 'code-formatter';

const content = `{"name":"ilex","identifier":"ac1bf435","_test":{"say":"hello","run":"fast"}}`;

const result = formatter(content, {
  method: 'json'
});

// 显示
<textarea value={result} />

options

  • method: String
  • step: ' ' 2 spaces
  • preserveComments: Boolean applies to cssmin and xmlmin functions
  • tabsize: Number
  • tabchar: \t

author

ilex.h

License

MIT

安装

# 安装到当前项目
npx skills add code-formatter

# 全局安装
npx skills add code-formatter -g

来源

  • 作者:ilex.h
  • npm 包:code-formatter

评论区

该文章暂未开放评论功能。