diff --git a/.travis.yml b/.travis.yml index 052e9ec..1b1756b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,4 @@ before_install: - gem install ruby-beautify --verbose - brew install python - pip install --upgrade autopep8 + - cabal install pandoc diff --git a/README.md b/README.md index af358f6..93cb368 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,11 @@ and that you set the `Python autopep8 path` in the package settings. Run `which autopep8` in your Terminal. +### Markdown + +To use with Markdown we require [pandoc](http://johnmacfarlane.net/pandoc/) +and you set the `Markdown Pandoc path` in the package settings. + ## Contributing diff --git a/lib/langs/markdown-beautify.coffee b/lib/langs/markdown-beautify.coffee new file mode 100644 index 0000000..d6c6339 --- /dev/null +++ b/lib/langs/markdown-beautify.coffee @@ -0,0 +1,18 @@ +### +Requires http: //johnmacfarlane.net/pandoc/ +### +getCmd = (inputPath, outputPath, options) -> + optionsStr = " --read markdown --write markdown --output \"" + outputPath + "\" \"" + inputPath + "\"" + + pandocPath = options.markdown_beautifier_path # jshint ignore: line + if pandocPath + + # Use absolute path + pandocPath + optionsStr + else + + # Use command available in $PATH + "pandoc" + optionsStr +"use strict" +cliBeautify = require("./cli-beautify") +module.exports = cliBeautify(getCmd) diff --git a/lib/language-options.coffee b/lib/language-options.coffee index 4611850..9061802 100644 --- a/lib/language-options.coffee +++ b/lib/language-options.coffee @@ -17,6 +17,7 @@ beautifyLESS = null beautifyCoffeeScript = null uncrustifyBeautifier = null beautifyHTMLERB = null +beautifyMarkdown = null # Misc Analytics = require("analytics-node") @@ -40,6 +41,7 @@ module.exports = "c" "cpp" "cs" + "markdown" "objectivec" "java" "d" @@ -86,6 +88,9 @@ module.exports = sql_keywords: "upper" sql_identifiers: "lower" sql_sqlformat_path: "" + + # Markdown + markdown_pandoc_path: "" # PHP php_beautifier_path: "" @@ -179,6 +184,9 @@ module.exports = when "Ruby" beautifyRuby ?= require("./langs/ruby-beautify") beautifyRuby text, self.getOptions("ruby", allOptions), beautifyCompleted + when "GitHub Markdown" + beautifyMarkdown ?= require("./langs/markdown-beautify") + beautifyMarkdown text, self.getOptions("markdown", allOptions), beautifyCompleted when "C" options = self.getOptions("c", allOptions) options.languageOverride = "C" @@ -273,7 +281,7 @@ module.exports = # console.log(selection, currOptions[selection]); _.merge collectedConfig, currOptions[selection] extend result, collectedConfig - , {}) + , {} ) # TODO: Clean. # There is a bug in nopt # See https://github.com/npm/nopt/issues/38#issuecomment-45971505 diff --git a/package.json b/package.json index 879a2ae..e567ce0 100644 --- a/package.json +++ b/package.json @@ -17,29 +17,23 @@ "email": "glavin.wiechert@gmail.com", "url": "https://github.com/Glavin001" }, - "contributors": [ - { - "name": "Donald Pipowitch", - "email": "pipo@senaeh.de", - "url": "https://github.com/donaldpipowitch" - }, - { - "name": "László Károlyi", - "url": "https://github.com/karolyi" - }, - { - "name": "Marco Tanzi", - "url": "https://github.com/mtanzi" - }, - { - "name": "gvn lazar suntop", - "url": "https://github.com/gvn" - }, - { - "name": "Vadim K.", - "url": "https://github.com/vadirn" - } - ], + "contributors": [{ + "name": "Donald Pipowitch", + "email": "pipo@senaeh.de", + "url": "https://github.com/donaldpipowitch" + }, { + "name": "László Károlyi", + "url": "https://github.com/karolyi" + }, { + "name": "Marco Tanzi", + "url": "https://github.com/mtanzi" + }, { + "name": "gvn lazar suntop", + "url": "https://github.com/gvn" + }, { + "name": "Vadim K.", + "url": "https://github.com/vadirn" + }], "keywords": [ "atom", "beautify", @@ -58,6 +52,7 @@ "scss", "less", "sql", + "markdown", "php", "python", "ruby",