Skip to content

Commit

Permalink
implement normalizing markdown through pandoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Bengt committed Sep 15, 2014
1 parent 30e8ce5 commit ad66227
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 24 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ before_install:
- gem install ruby-beautify --verbose
- brew install python
- pip install --upgrade autopep8
- cabal install pandoc
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 18 additions & 0 deletions lib/langs/markdown-beautify.coffee
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 9 additions & 1 deletion lib/language-options.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ beautifyLESS = null
beautifyCoffeeScript = null
uncrustifyBeautifier = null
beautifyHTMLERB = null
beautifyMarkdown = null

# Misc
Analytics = require("analytics-node")
Expand All @@ -40,6 +41,7 @@ module.exports =
"c"
"cpp"
"cs"
"markdown"
"objectivec"
"java"
"d"
Expand Down Expand Up @@ -86,6 +88,9 @@ module.exports =
sql_keywords: "upper"
sql_identifiers: "lower"
sql_sqlformat_path: ""

# Markdown
markdown_pandoc_path: ""

# PHP
php_beautifier_path: ""
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
41 changes: 18 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -58,6 +52,7 @@
"scss",
"less",
"sql",
"markdown",
"php",
"python",
"ruby",
Expand Down

0 comments on commit ad66227

Please sign in to comment.