Html 格式化/加密/压缩

Hello World!

`; const minify = require('html-minifier').minify; $("#code").html(defaultvalue); var initcodemirror = CodeMirror.fromTextArea(document.getElementById("code"), { // 标识到textarea value: defaultvalue, // 文本域默认显示的文本 mode: {name: "htmlmixed"}, // 模式 theme: "mdn-like", // CSS样式选择 indentUnit: 2, // 缩进单位,默认2 smartIndent: true, // 是否智能缩进 tabSize: 4, // Tab缩进,默认4 readOnly: false, // 是否只读,默认false showCursorWhenSelecting: true, lineNumbers: true, // 是否显示行号 lineWrapping: true, matchBrackets: true, }); function format() { initcodemirror.setValue(beautifier.html(initcodemirror.getValue())); } function compress() { initcodemirror.setValue(minify(initcodemirror.getValue(), { minifyCSS: true, minifyJS: true, removeComments: true, collapseWhitespace: true, decodeEntities: true, trimCustomFragments: true, })); } function encode(){ var minifyCode = minify(initcodemirror.getValue(), { minifyCSS: true, minifyJS: true, removeComments: true, collapseWhitespace: true, decodeEntities: true, trimCustomFragments: true, }) var code = `