From 52933a878ffcf5630d5c44e461656aa8c009f0e0 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 9 Jan 2018 14:12:26 +0300 Subject: [PATCH 1/7] Use Remark beautifier for markdown files by default --- src/languages/markdown.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/markdown.coffee b/src/languages/markdown.coffee index 2f6aaea..a6a3ad1 100644 --- a/src/languages/markdown.coffee +++ b/src/languages/markdown.coffee @@ -18,7 +18,7 @@ module.exports = { "md" ] - defaultBeautifier: "Tidy Markdown" + defaultBeautifier: "Remark" options: gfm: From d0918e9f341bb1cae2995a13e0c6348b90810090 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 9 Jan 2018 14:22:10 +0300 Subject: [PATCH 2/7] Update docs --- README.md | 2 +- docs/options.md | 2 +- src/options.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 951a101..239161c 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | LaTeX | `BibTeX`, `LaTeX`, `TeX` |`.bib`, `.tex`, `.sty`, `.cls`, `.dtx`, `.ins`, `.bbx`, `.cbx` | **[`Latex Beautify`](https://github.com/cmhughes/latexindent.pl)** | | LESS | `LESS` |`.less` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`CSScomb`](https://github.com/csscomb/csscomb.js) | | Lua | `Lua` |`.lua`, `.ttslua` | **[`Lua beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.coffee)** | -| Markdown | `GitHub Markdown` |`.markdown`, `.md` | **[`Tidy Markdown`](https://github.com/slang800/tidy-markdown)**, [`Remark`](https://github.com/wooorm/remark) | +| Markdown | `GitHub Markdown` |`.markdown`, `.md` | **[`Remark`](https://github.com/wooorm/remark)**, [`Tidy Markdown`](https://github.com/slang800/tidy-markdown) | | Marko | `Marko` |`.marko` | **[`Marko Beautifier`](https://github.com/marko-js/marko-prettyprint)** | | Mustache | `HTML (Mustache)` |`.mustache` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Nginx | `nginx` |`.conf` | **[`Nginx Beautify`](https://github.com/denysvitali/nginxbeautify)** | diff --git a/docs/options.md b/docs/options.md index 0ae2840..405a296 100644 --- a/docs/options.md +++ b/docs/options.md @@ -8072,7 +8072,7 @@ Disable Markdown Beautification **Important**: This option is only configurable from within Atom Beautify's setting panel. -**Default**: `Tidy Markdown` +**Default**: `Remark` **Type**: `string` diff --git a/src/options.json b/src/options.json index 35bda1b..d9b70d9 100644 --- a/src/options.json +++ b/src/options.json @@ -4697,7 +4697,7 @@ "title": "Default Beautifier", "order": -2, "type": "string", - "default": "Tidy Markdown", + "default": "Remark", "description": "Default Beautifier to be used for Markdown", "enum": [ "Remark", From d6ee1cf4a3dd847e9357176a972c71763c9acaa6 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 9 Jan 2018 14:22:20 +0300 Subject: [PATCH 3/7] Add CHANGELOG item --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3284e8d..f85344d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Next - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable +- Switch to Remark as a default markdown beautifier due to a more active state of its community compared to Tidy Markdown # v0.30.9 (2017-11-22) - Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed. From 0525c05ea86c0ac7dd514c5f69f3276b64947dfc Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 30 Jan 2018 11:37:06 +0000 Subject: [PATCH 4/7] Update markdown tests --- .../nested-jsbeautifyrc/markdown/expected/test.md | 1 - .../simple-jsbeautifyrc/markdown/expected/test.md | 12 ++++++------ .../markdown/expected/yaml-front-matter-3.md | 11 ++++------- .../markdown/expected/yaml-front-matter.md | 9 +++++---- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/examples/nested-jsbeautifyrc/markdown/expected/test.md b/examples/nested-jsbeautifyrc/markdown/expected/test.md index 260f04f..6cda824 100644 --- a/examples/nested-jsbeautifyrc/markdown/expected/test.md +++ b/examples/nested-jsbeautifyrc/markdown/expected/test.md @@ -1,5 +1,4 @@ - item - 1. one 2. two 3. three diff --git a/examples/simple-jsbeautifyrc/markdown/expected/test.md b/examples/simple-jsbeautifyrc/markdown/expected/test.md index 9bef71c..1c3eeda 100644 --- a/examples/simple-jsbeautifyrc/markdown/expected/test.md +++ b/examples/simple-jsbeautifyrc/markdown/expected/test.md @@ -1,11 +1,11 @@ # heading 1 -- item -- item -- item +- item +- item +- item ## heading 2 -1. one -2. two -3. three +1. one +2. two +3. three diff --git a/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter-3.md b/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter-3.md index 5f92234..1ec8989 100644 --- a/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter-3.md +++ b/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter-3.md @@ -13,15 +13,12 @@ pets: - bat match: !!js/regexp /pattern/gim run: !!js/function function() { } - - - --- -- item -- item +- item +- item - item -1. one +1. one 2. two -2. three +3. three diff --git a/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter.md b/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter.md index efd85dc..fe81501 100644 --- a/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter.md +++ b/examples/simple-jsbeautifyrc/markdown/expected/yaml-front-matter.md @@ -1,7 +1,8 @@ --- -layout: default -title: this is my title -description: this is my description +layout: default +title: this is my title +description: this is my description --- -test ing + test + ing From 18e7f5ebad5f83e25a6a03e05ee15ada93329328 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 30 Jan 2018 11:39:42 +0000 Subject: [PATCH 5/7] Update link to remark repo --- README.md | 2 +- src/beautifiers/remark.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 239161c..8a908e5 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ See [all supported options in the documentation at `docs/options.md`](docs/opti | LaTeX | `BibTeX`, `LaTeX`, `TeX` |`.bib`, `.tex`, `.sty`, `.cls`, `.dtx`, `.ins`, `.bbx`, `.cbx` | **[`Latex Beautify`](https://github.com/cmhughes/latexindent.pl)** | | LESS | `LESS` |`.less` | **[`Pretty Diff`](https://github.com/prettydiff/prettydiff)**, [`CSScomb`](https://github.com/csscomb/csscomb.js) | | Lua | `Lua` |`.lua`, `.ttslua` | **[`Lua beautifier`](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.coffee)** | -| Markdown | `GitHub Markdown` |`.markdown`, `.md` | **[`Remark`](https://github.com/wooorm/remark)**, [`Tidy Markdown`](https://github.com/slang800/tidy-markdown) | +| Markdown | `GitHub Markdown` |`.markdown`, `.md` | **[`Remark`](https://github.com/remarkjs/remark)**, [`Tidy Markdown`](https://github.com/slang800/tidy-markdown) | | Marko | `Marko` |`.marko` | **[`Marko Beautifier`](https://github.com/marko-js/marko-prettyprint)** | | Mustache | `HTML (Mustache)` |`.mustache` | **[`JS Beautify`](https://github.com/beautify-web/js-beautify)**, [`Pretty Diff`](https://github.com/prettydiff/prettydiff) | | Nginx | `nginx` |`.conf` | **[`Nginx Beautify`](https://github.com/denysvitali/nginxbeautify)** | diff --git a/src/beautifiers/remark.coffee b/src/beautifiers/remark.coffee index 2f34ca9..4885919 100644 --- a/src/beautifiers/remark.coffee +++ b/src/beautifiers/remark.coffee @@ -3,7 +3,7 @@ Beautifier = require('./beautifier') module.exports = class Remark extends Beautifier name: "Remark" - link: "https://github.com/wooorm/remark" + link: "https://github.com/remarkjs/remark" options: { _: { gfm: true From 74efe30ae0b0be6c12a0a5878a08ea299d20dfd1 Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 6 Feb 2018 15:55:37 +0000 Subject: [PATCH 6/7] Add tests for custom Remark options in .jsbeautifyrc --- examples/nested-jsbeautifyrc/.jsbeautifyrc | 5 +++++ .../markdown/expected/code-blocks.md | 17 +++++++++++++++++ .../markdown/expected/headers.md | 9 +++++++++ .../markdown/expected/inline-markers.md | 3 +++ .../markdown/expected/{test.md => lists.md} | 0 .../markdown/original/code-blocks.md | 15 +++++++++++++++ .../markdown/original/headers.md | 7 +++++++ .../markdown/original/inline-markers.md | 3 +++ .../markdown/original/{test.md => lists.md} | 0 9 files changed, 59 insertions(+) create mode 100644 examples/nested-jsbeautifyrc/markdown/expected/code-blocks.md create mode 100644 examples/nested-jsbeautifyrc/markdown/expected/headers.md create mode 100644 examples/nested-jsbeautifyrc/markdown/expected/inline-markers.md rename examples/nested-jsbeautifyrc/markdown/expected/{test.md => lists.md} (100%) create mode 100644 examples/nested-jsbeautifyrc/markdown/original/code-blocks.md create mode 100644 examples/nested-jsbeautifyrc/markdown/original/headers.md create mode 100644 examples/nested-jsbeautifyrc/markdown/original/inline-markers.md rename examples/nested-jsbeautifyrc/markdown/original/{test.md => lists.md} (100%) diff --git a/examples/nested-jsbeautifyrc/.jsbeautifyrc b/examples/nested-jsbeautifyrc/.jsbeautifyrc index 693c649..e911504 100644 --- a/examples/nested-jsbeautifyrc/.jsbeautifyrc +++ b/examples/nested-jsbeautifyrc/.jsbeautifyrc @@ -56,6 +56,11 @@ indent_size: 4 markdown: listItemIndent: 1 + strong: '_' + emphasis: '_' + fences: true + fence: '`' + setext: true jade: indent_size: 4 indent_char: " " diff --git a/examples/nested-jsbeautifyrc/markdown/expected/code-blocks.md b/examples/nested-jsbeautifyrc/markdown/expected/code-blocks.md new file mode 100644 index 0000000..012f43e --- /dev/null +++ b/examples/nested-jsbeautifyrc/markdown/expected/code-blocks.md @@ -0,0 +1,17 @@ +A code block with correct fences: + +```js +console.log('hello world!') +``` + +A code block with mistyped fences: + +```js +console.log('hello world!') +``` + +Code block with forgotten fences: + +``` +console.log('hello world!') +``` diff --git a/examples/nested-jsbeautifyrc/markdown/expected/headers.md b/examples/nested-jsbeautifyrc/markdown/expected/headers.md new file mode 100644 index 0000000..a8e695a --- /dev/null +++ b/examples/nested-jsbeautifyrc/markdown/expected/headers.md @@ -0,0 +1,9 @@ +Header 1 +======== + +Header 2 +-------- + +### Header 3 + +Hello! diff --git a/examples/nested-jsbeautifyrc/markdown/expected/inline-markers.md b/examples/nested-jsbeautifyrc/markdown/expected/inline-markers.md new file mode 100644 index 0000000..f56d701 --- /dev/null +++ b/examples/nested-jsbeautifyrc/markdown/expected/inline-markers.md @@ -0,0 +1,3 @@ +An example of __bold__ and _italics_. + +Another example of __bold__ and _italics_. diff --git a/examples/nested-jsbeautifyrc/markdown/expected/test.md b/examples/nested-jsbeautifyrc/markdown/expected/lists.md similarity index 100% rename from examples/nested-jsbeautifyrc/markdown/expected/test.md rename to examples/nested-jsbeautifyrc/markdown/expected/lists.md diff --git a/examples/nested-jsbeautifyrc/markdown/original/code-blocks.md b/examples/nested-jsbeautifyrc/markdown/original/code-blocks.md new file mode 100644 index 0000000..686caf5 --- /dev/null +++ b/examples/nested-jsbeautifyrc/markdown/original/code-blocks.md @@ -0,0 +1,15 @@ +A code block with correct fences: + +```js +console.log('hello world!') +``` + +A code block with mistyped fences: + +~~~js +console.log('hello world!') +~~~ + +Code block with forgotten fences: + + console.log('hello world!') diff --git a/examples/nested-jsbeautifyrc/markdown/original/headers.md b/examples/nested-jsbeautifyrc/markdown/original/headers.md new file mode 100644 index 0000000..cf264a3 --- /dev/null +++ b/examples/nested-jsbeautifyrc/markdown/original/headers.md @@ -0,0 +1,7 @@ +# Header 1 + +## Header 2 + +### Header 3 + +Hello! diff --git a/examples/nested-jsbeautifyrc/markdown/original/inline-markers.md b/examples/nested-jsbeautifyrc/markdown/original/inline-markers.md new file mode 100644 index 0000000..c3d1a8b --- /dev/null +++ b/examples/nested-jsbeautifyrc/markdown/original/inline-markers.md @@ -0,0 +1,3 @@ +An example of **bold** and *italics*. + +Another example of __bold__ and _italics_. diff --git a/examples/nested-jsbeautifyrc/markdown/original/test.md b/examples/nested-jsbeautifyrc/markdown/original/lists.md similarity index 100% rename from examples/nested-jsbeautifyrc/markdown/original/test.md rename to examples/nested-jsbeautifyrc/markdown/original/lists.md From b8fa55235f58d175a64e25e2830b8e729f7f230c Mon Sep 17 00:00:00 2001 From: Alexander Kachkaev Date: Tue, 6 Feb 2018 16:09:09 +0000 Subject: [PATCH 7/7] Describe breaking changes in CHANGELOG --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fa8acb..1f1c0f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ # Next - Fix [#1862](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for ocp-indent as an executable - See [#601](https://github.com/Glavin001/atom-beautify/issues/1862) Add support for tsx files -- Switch to Remark as a default markdown beautifier due to a more active state of its community compared to Tidy Markdown +- Switch to Remark as a default markdown beautifier due to a more active state of its community compared to Tidy Markdown ([#2004](https://github.com/Glavin001/atom-beautify/pull/2004)). + This is a __breaking change__ for Tidy Markdown users: + - list indentation is now four characters per level (three spaces after `-` for unordered lists and two spaces after `N.` in ordered lists) + - the contents of frontmatter are no longer formatted + + You can easily switch back to the old behaviour by choosing _Tidy Markdown_ in package preferences. + Alternatively, you can customise Remark beautifier with `.jsbeautifyrc` (see [available options](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify#options)). # v0.30.9 (2017-11-22) - Fix [#1949](https://github.com/Glavin001/atom-beautify/issues/1949): Fix beautify on save when text has not changed.