add: remark for markdown

This commit is contained in:
Ra100 2016-01-28 13:11:09 +01:00
parent b0dab1ea23
commit 2dce172228
7 changed files with 249 additions and 6 deletions

View File

@ -1547,6 +1547,82 @@ If a terminating comma should be inserted into arrays, object literals, and dest
} }
``` ```
#### [Markdown - Gfm](#markdown---gfm)
**Namespace**: `markdown`
**Key**: `gfm`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`Remark`](#remark)
**Description**:
GitHub Flavoured Markdown (Supported by Remark)
**Example `.jsbeautifyrc` Configuration**
```json
{
"markdown": {
"gfm": true
}
}
```
#### [Markdown - Yaml](#markdown---yaml)
**Namespace**: `markdown`
**Key**: `yaml`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`Remark`](#remark)
**Description**:
Enables raw YAML front matter to be detected (thus ignoring markdown-like syntax). (Supported by Remark)
**Example `.jsbeautifyrc` Configuration**
```json
{
"markdown": {
"yaml": true
}
}
```
#### [Markdown - Commonmark](#markdown---commonmark)
**Namespace**: `markdown`
**Key**: `commonmark`
**Type**: `boolean`
**Supported Beautifiers**: [`Remark`](#remark)
**Description**:
Allows and disallows several constructs. (Supported by Remark)
**Example `.jsbeautifyrc` Configuration**
```json
{
"markdown": {
"commonmark": false
}
}
```
#### [Objective-C - Config Path](#objective-c---config-path) #### [Objective-C - Config Path](#objective-c---config-path)
**Namespace**: `objectivec` **Namespace**: `objectivec`
@ -1699,11 +1775,11 @@ By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP
**Type**: `string` **Type**: `string`
**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) **Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf)
**Description**: **Description**:
Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer, PHPCBF)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
@ -3286,7 +3362,7 @@ Disable Markdown Beautification
**Type**: `string` **Type**: `string`
**Enum**: `Tidy Markdown` **Enum**: `Remark` `Tidy Markdown`
**Description**: **Description**:
@ -6447,6 +6523,85 @@ Path to the emacs script (Supported by Fortran Beautifier)
``` ```
### Remark
#### [Markdown - Gfm](#markdown---gfm)
**Namespace**: `markdown`
**Key**: `gfm`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`Remark`](#remark)
**Description**:
GitHub Flavoured Markdown (Supported by Remark)
**Example `.jsbeautifyrc` Configuration**
```json
{
"markdown": {
"gfm": true
}
}
```
#### [Markdown - Yaml](#markdown---yaml)
**Namespace**: `markdown`
**Key**: `yaml`
**Default**: `true`
**Type**: `boolean`
**Supported Beautifiers**: [`Remark`](#remark)
**Description**:
Enables raw YAML front matter to be detected (thus ignoring markdown-like syntax). (Supported by Remark)
**Example `.jsbeautifyrc` Configuration**
```json
{
"markdown": {
"yaml": true
}
}
```
#### [Markdown - Commonmark](#markdown---commonmark)
**Namespace**: `markdown`
**Key**: `commonmark`
**Type**: `boolean`
**Supported Beautifiers**: [`Remark`](#remark)
**Description**:
Allows and disallows several constructs. (Supported by Remark)
**Example `.jsbeautifyrc` Configuration**
```json
{
"markdown": {
"commonmark": false
}
}
```
### Perltidy ### Perltidy
#### [Perl - Perltidy profile](#perl---perltidy-profile) #### [Perl - Perltidy profile](#perl---perltidy-profile)
@ -6556,11 +6711,11 @@ By default, all PSR-2 fixers and some additional ones are run. (Supported by PHP
**Type**: `string` **Type**: `string`
**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) **Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf)
**Description**: **Description**:
Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer) Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer, PHPCBF)
**Example `.jsbeautifyrc` Configuration** **Example `.jsbeautifyrc` Configuration**
@ -6599,6 +6754,30 @@ Standard name Squiz, PSR2, PSR1, PHPCS, PEAR, Zend, MySource... or path to CS ru
### PHPCBF ### PHPCBF
#### [PHP - PHPCBF Path](#php---phpcbf-path)
**Namespace**: `php`
**Key**: `phpcbf_path`
**Type**: `string`
**Supported Beautifiers**: [`PHP-CS-Fixer`](#php-cs-fixer) [`PHPCBF`](#phpcbf)
**Description**:
Path to the `phpcbf` CLI executable (Supported by PHP-CS-Fixer, PHPCBF)
**Example `.jsbeautifyrc` Configuration**
```json
{
"php": {
"phpcbf_path": ""
}
}
```
#### [PHP - PHPCBF Standard](#php---phpcbf-standard) #### [PHP - PHPCBF Standard](#php---phpcbf-standard)
**Namespace**: `php` **Namespace**: `php`

View File

@ -38,3 +38,5 @@
indent_size: 4 indent_size: 4
erb: erb:
indent_size: 4 indent_size: 4
markdown:
listItemIndent: 1

View File

@ -26,5 +26,8 @@
"indent_char": " ", "indent_char": " ",
"indent_level": 0, "indent_level": 0,
"indent_with_tabs": false "indent_with_tabs": false
},
"markdown": {
"listItemIndent": "1"
} }
} }

View File

@ -91,6 +91,7 @@
"node-dir": "^0.1.8", "node-dir": "^0.1.8",
"node-uuid": "^1.4.3", "node-uuid": "^1.4.3",
"prettydiff": "^1.16.8", "prettydiff": "^1.16.8",
"remark": "^3.2.2",
"season": "^5.3.0", "season": "^5.3.0",
"space-pen": "^5.1.1", "space-pen": "^5.1.1",
"strip-json-comments": "^1.0.2", "strip-json-comments": "^1.0.2",

View File

@ -51,6 +51,7 @@ module.exports = class Beautifiers extends EventEmitter
'phpcbf' 'phpcbf'
'prettydiff' 'prettydiff'
'puppet-fix' 'puppet-fix'
'remark'
'rubocop' 'rubocop'
'ruby-beautify' 'ruby-beautify'
'rustfmt' 'rustfmt'

View File

@ -0,0 +1,44 @@
"use strict"
Beautifier = require('./beautifier')
module.exports = class Remark extends Beautifier
name: "Remark"
options: {
_: {
gfm: true
yaml: true
commonmark: true
footnotes: true
pedantic: true
breaks: true
entities: true
setext: true
closeAtx: true
looseTable: true
spacedTable: true
fence: true
fences: true
bullet: true
listItemIndent: true
incrementListMarker: true
rule: true
ruleRepetition: true
ruleSpaces: true
strong: true
emphasis: true
position: true
}
Markdown: true
}
beautify: (text, language, options) ->
return new @Promise((resolve, reject) ->
try
console.log(options)
remark = require 'remark'
cleanMarkdown = remark.process(text, options)
resolve cleanMarkdown
catch err
@error("Remark error: #{err}")
reject(err)
)

View File

@ -18,6 +18,19 @@ module.exports = {
"md" "md"
] ]
options: [] defaultBeautifier: "Tidy Markdown"
options:
gfm:
type: 'boolean'
default: true
description: 'GitHub Flavoured Markdown'
yaml:
type: 'boolean'
default: true
description: 'Enables raw YAML front matter to be detected (thus ignoring markdown-like syntax).'
commonmark:
type: 'boolean'
default: false
description: 'Allows and disallows several constructs.'
} }