缩放输出格式 
Emmet缩写的输出格式集. 带 解析缩写 并返回其字符串表示式,按照给定的格式 产出简介,在一个支持的语法中:
- HTML( 包括 XML 和 XHTML)
- 汉字
- 帕格语Name
- 斯莱姆
套装
默认捆绑包含所有支持的语法 。 如果您不需要全部, 并且想要略微切下自己的捆绑大小, 您可以直接导入所需的格式化 :
// 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
实例
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'));