implement normalizing markdown through pandoc

This commit is contained in:
Bengt Lüers 2014-09-15 23:06:37 +02:00
parent 30e8ce5971
commit ad662271c1
5 changed files with 51 additions and 24 deletions

View File

@ -12,3 +12,4 @@ before_install:
- gem install ruby-beautify --verbose - gem install ruby-beautify --verbose
- brew install python - brew install python
- pip install --upgrade autopep8 - pip install --upgrade autopep8
- cabal install pandoc

View File

@ -191,6 +191,11 @@ and that you set the `Python autopep8 path` in the package settings.
Run `which autopep8` in your Terminal. 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 ## Contributing

View File

@ -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)

View File

@ -17,6 +17,7 @@ beautifyLESS = null
beautifyCoffeeScript = null beautifyCoffeeScript = null
uncrustifyBeautifier = null uncrustifyBeautifier = null
beautifyHTMLERB = null beautifyHTMLERB = null
beautifyMarkdown = null
# Misc # Misc
Analytics = require("analytics-node") Analytics = require("analytics-node")
@ -40,6 +41,7 @@ module.exports =
"c" "c"
"cpp" "cpp"
"cs" "cs"
"markdown"
"objectivec" "objectivec"
"java" "java"
"d" "d"
@ -87,6 +89,9 @@ module.exports =
sql_identifiers: "lower" sql_identifiers: "lower"
sql_sqlformat_path: "" sql_sqlformat_path: ""
# Markdown
markdown_pandoc_path: ""
# PHP # PHP
php_beautifier_path: "" php_beautifier_path: ""
@ -179,6 +184,9 @@ module.exports =
when "Ruby" when "Ruby"
beautifyRuby ?= require("./langs/ruby-beautify") beautifyRuby ?= require("./langs/ruby-beautify")
beautifyRuby text, self.getOptions("ruby", allOptions), beautifyCompleted beautifyRuby text, self.getOptions("ruby", allOptions), beautifyCompleted
when "GitHub Markdown"
beautifyMarkdown ?= require("./langs/markdown-beautify")
beautifyMarkdown text, self.getOptions("markdown", allOptions), beautifyCompleted
when "C" when "C"
options = self.getOptions("c", allOptions) options = self.getOptions("c", allOptions)
options.languageOverride = "C" options.languageOverride = "C"
@ -273,7 +281,7 @@ module.exports =
# console.log(selection, currOptions[selection]); # console.log(selection, currOptions[selection]);
_.merge collectedConfig, currOptions[selection] _.merge collectedConfig, currOptions[selection]
extend result, collectedConfig extend result, collectedConfig
, {}) , {} )
# TODO: Clean. # TODO: Clean.
# There is a bug in nopt # There is a bug in nopt
# See https://github.com/npm/nopt/issues/38#issuecomment-45971505 # See https://github.com/npm/nopt/issues/38#issuecomment-45971505

View File

@ -17,29 +17,23 @@
"email": "glavin.wiechert@gmail.com", "email": "glavin.wiechert@gmail.com",
"url": "https://github.com/Glavin001" "url": "https://github.com/Glavin001"
}, },
"contributors": [ "contributors": [{
{ "name": "Donald Pipowitch",
"name": "Donald Pipowitch", "email": "pipo@senaeh.de",
"email": "pipo@senaeh.de", "url": "https://github.com/donaldpipowitch"
"url": "https://github.com/donaldpipowitch" }, {
}, "name": "László Károlyi",
{ "url": "https://github.com/karolyi"
"name": "László Károlyi", }, {
"url": "https://github.com/karolyi" "name": "Marco Tanzi",
}, "url": "https://github.com/mtanzi"
{ }, {
"name": "Marco Tanzi", "name": "gvn lazar suntop",
"url": "https://github.com/mtanzi" "url": "https://github.com/gvn"
}, }, {
{ "name": "Vadim K.",
"name": "gvn lazar suntop", "url": "https://github.com/vadirn"
"url": "https://github.com/gvn" }],
},
{
"name": "Vadim K.",
"url": "https://github.com/vadirn"
}
],
"keywords": [ "keywords": [
"atom", "atom",
"beautify", "beautify",
@ -58,6 +52,7 @@
"scss", "scss",
"less", "less",
"sql", "sql",
"markdown",
"php", "php",
"python", "python",
"ruby", "ruby",