diff --git a/src/Console/Log.js b/src/Console/Log.js index decfcb7..2f34292 100644 --- a/src/Console/Log.js +++ b/src/Console/Log.js @@ -410,7 +410,7 @@ function formatErr(err) { function formatJs(code) { const curTheme = evalCss.getCurTheme() - return highlight(beautify(code), 'js', { + return highlight(beautify(code, { indent_size: 2 }), 'js', { keyword: `color:${curTheme.keywordColor}`, number: `color:${curTheme.numberColor}`, operator: `color:${curTheme.operatorColor}`, @@ -542,7 +542,7 @@ function formatFn(val) { function formatEl(val) { return `
${highlight(
- beautify.html(val.outerHTML, { unformatted: [] }),
+ beautify.html(val.outerHTML, { unformatted: [], indent_size: 2 }),
'html'
)}`
}
diff --git a/src/Sources/Sources.js b/src/Sources/Sources.js
index 942ee99..6252023 100644
--- a/src/Sources/Sources.js
+++ b/src/Sources/Sources.js
@@ -185,13 +185,13 @@ export default class Sources extends Tool {
if (len < MAX_BEAUTIFY_LEN && this._formatCode) {
switch (data.type) {
case 'html':
- code = beautify.html(code, { unformatted: [] })
+ code = beautify.html(code, { unformatted: [], indent_size: 2 })
break
case 'css':
- code = beautify.css(code)
+ code = beautify.css(code, { indent_size: 2 })
break
case 'js':
- code = beautify(code)
+ code = beautify(code, { indent_size: 2 })
break
}