Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 702 Bytes

README.md

File metadata and controls

35 lines (24 loc) · 702 Bytes

xxml-formatter

A formatter for xxml based on htmlparser2

xxml is a kind of DSL used wildly by Chinese microapps such as:

  • .wxml - Weixin microapp
  • .ttml - Bytedance microapp
  • .swan - Baidu microapp
  • .axml - Alipay microapp

Usage

import Formatter from 'xxml-formatter';
const formatter = new Formatter({ tabSize: 2 });

const sourceCode = `<view><text>hello world</text></view>`;
const resultCode = formatter.format(sourceCode);
console.log(resultCode);

Output (simplified):

<view>
  <text>hello world</text>
</view>