diff --git a/index.html b/index.html index 1cb9309..d0c4ca6 100644 --- a/index.html +++ b/index.html @@ -24,6 +24,7 @@
  • XML
  • JavaScript
  • CSS
  • +
  • SQL
  • diff --git a/index.js b/index.js index 90c2500..3472ce5 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,9 @@ var beautify_html = require('js-beautify').html; // xml-beautify library var beautify_xml = require('xml-beautifier'); +// sql-formatter library +var beautify_sql = require('sql-formatter'); + $('window').ready(function () { @@ -51,6 +54,7 @@ $('window').ready(function () { case 'json': case 'js': case 'css': + case 'sql': $('#navbar').find('>ul>li.active').removeClass('active'); $('#'+type+'_tab').addClass('active'); @@ -96,6 +100,8 @@ $('window').ready(function () { case 'css': stringOut = hljs.highlightAuto(beautify_css(stringIn)).value; break; + case 'sql': + stringOut = hljs.highlightAuto(beautify_sql.format(stringIn)).value; } } catch (e) { stringOut = 'Error: Unable to parse ' + type + '
    ' + e; diff --git a/package.json b/package.json index 0ed574a..507aa0b 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "htmllint": "^0.6.0", "jquery": "^3.1.1", "js-beautify": "^1.6.11", + "sql-formatter": "^1.2.0", "uglifyify": "^3.0.4", "xml-beautifier": "^0.3.0" },