@emmetio/markup-formatters

中文文档
0.4.1发布于 2018/12/03MITESM + CJS近 30 天下载 4275

Formats and outputs Emmet abbreviation in different markup languages (HTML, XML, Slim, Pug etc)

原始使用文档

Emmet output formatters Build Status

A collection of output formatters for Emmet abbreviations. Takes parsed abbreviation and returns its string representation, formatted according to given output profile, in one of supported syntax:

  • HTML (including XML and XHTML)
  • HAML
  • Pug
  • Slim

Bundles

The default bundle contains all supported syntaxes. If you don’t need all of them and want to cut-down your own bundle size a bit, you can import required formatters directly:

// import all formatters
import format from '@emmetio/markup-formatters';

// import HTML formatter only
import html from '@emmetio/markup-formatters/dist/html.es.js';
// ...also available as CommonJS module, e.g. dist/html.cjs.js

Examples

import parse from '@emmetio/abbreviation';
import Profile from '@emmetio/output-profile';
import format from '@emmetio/markup-formatters';

// parse abbreviation first
const abbr = parse('ul>li.item*3>img');

// output as HTML
const htmlProfile = new Profile({
    compactBooleanAttributes: true
});
console.log(format(abbr, htmlProfile, 'html'));

// output as XML
const xmlProfile = new Profile({
    selfClosingStyle: 'xml',
    inlineBreak: 0
});
console.log(format(abbr, xmlProfile, 'html'));

// output as Slim
console.log(format(abbr, new Profile(), 'slim'));

版本与发布记录

@emmetio/markup-formatters 共发布 9 个版本,首次发布于 2017/01/09;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.4.1latest2018/12/037 年前
0.4.02018/03/218 年前
0.3.32017/05/119 年前
0.3.22017/03/239 年前
0.3.12017/01/309 年前
0.3.02017/01/309 年前

关于 @emmetio/markup-formatters 的常见问题

@emmetio/markup-formatters 是什么?

Formats and outputs Emmet abbreviation in different markup languages (HTML, XML, Slim, Pug etc)

如何安装 @emmetio/markup-formatters?

在项目目录运行 npm install @emmetio/markup-formatters,或使用 pnpm add / yarn add / bun add。

@emmetio/markup-formatters 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/emmetio__markup-formatters 是否存在。

@emmetio/markup-formatters 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@emmetio/markup-formatters 可以商用吗?

@emmetio/markup-formatters 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@emmetio/markup-formatters 的下载量有多少?

根据 npm 官方下载统计,@emmetio/markup-formatters 在 2026/10/14 – 2026/11/12 这 30 天内被下载 4,275 次,日均约 143 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@emmetio/markup-formatters 还在维护吗?

最新版本 0.4.1 发布于 2018/12/03(7 年前);至今共发布 9 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/01/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。