Skip to content

Commit

Permalink
Update to remark 13.0.0 (micromark) (#29)
Browse files Browse the repository at this point in the history
remark 13.0.0 [1] is a giant change for remark that replaced the 5+ year
old internals with a new low-level parser called micromark [2].
It comes with 100% CommonMark (and GFM as an extension) compliance and
is a good base for the future of remark and Markdown.

>> Migration

This projects uses remark through the remark-lint [3] plugin, which
introduced support for remark `13.0.0` in its package version
`8.0.0` [4], and the remark-cli][5 package, which comes with support for
remark `13.0.0` in its package version `9.0.0` [6].

- Updated `remark-cli` - bumped minimum version from `5.0.0` to
  `9.0.0` [7]
- Updated `remark-lint` - bumped minimum version from `6.0.1` to
  `8.0.0` [8]
- Updated all `remark-lint-*` packages - the
  `@arcticicestudio/remark-preset-lint` [9] packages supports all
  `remark-lint-*` core rule packages whose minimum versions are now
  bumped to the major version that introduced support for remark
  `13.0.0`.
- Added `remark-gfm` plugin [10] - the support for GitHub Flavored
  Markdown [11] has been moved into the `remark-gfm` plugin.
- Added `remark-footnotes` plugin [12] - adds support for Pandoc [13]
  footnotes.
- Validated the code base with new linter rules - Run checks with
  updated packages afterwards to fix and improve results found by
  linters.

>> Features

Because most package versions used before were not up-to-date,
support for new features like core rules has also been added:

- Support for `remark-lint-no-duplicate-defined-urls` [14] - the core
  rule warns when definitions define the same URL.
- Support for `remark-lint-no-unneeded-full-reference-image` [15] - the
  core rule warns when full reference images are used that could be
  collapsed.
- Support for `remark-lint-no-unneeded-full-reference-link` [16] - the
  core rule warns when full reference links are used that could be
  collapsed.

[1]: https://github.com/remarkjs/remark/releases/tag/13.0.0
[2]: https://github.com/micromark/micromark
[3]: https://github.com/remarkjs/remark-lint
[4]: https://github.com/remarkjs/remark-lint/releases/tag/8.0.0
[5]: https://github.com/remarkjs/remark
[6]: https://github.com/remarkjs/remark/releases/tag/remark-cli%409.0.0
[7]: https://github.com/remarkjs/remark/compare/remark-cli@5.0.0...remark-cli@9.0.0
[8]: remarkjs/remark-lint@6.0.0...8.0.0
[9]: https://github.com/arcticicestudio/styleguide-markdown/tree/main/packages/%40arcticicestudio/remark-preset-lint
[10]: https://github.com/remarkjs/remark-gfm
[11]: https://github.github.com/gfm
[12]: https://github.com/remarkjs/remark-footnotes
[13]: https://pandoc.org
[14]: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-defined-urls
[15]: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unneeded-full-reference-image
[16]: https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unneeded-full-reference-link

Co-authored-by: Sven Greb <development@svengreb.de>

Closes GH-28
  • Loading branch information
arcticicestudio committed Apr 5, 2021
1 parent c7946f2 commit 9ff968f
Show file tree
Hide file tree
Showing 28 changed files with 274 additions and 190 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<details>
<summary><strong>Change unordered marker from asterisk to dash</strong> — #1 ⇄ #2 (⊶ 261fe4cb)</summary>

↠ Added the initial style guide with the [comprehensive base rule set][docs-rules] with support for [GitHub Flavored Markdown][gfm] which is based on the [CommonMark][commonmark] specification.
↠ Added the initial style guide with the [comprehensive base rule set][docs-rules] with support for [GitHub Flavored Markdown][gfm] which is based on the [CommonMark][] specification.

</details>

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ When [reporting a bug](#bug-reports), sometimes even when [suggesting enhancemen
- …Complete – Provide all parts needed to reproduce the behavior
- …Verifiable – Test the code you're about to provide to make sure it reproduces the behavior

A MCVE is a common practice like on [Stack Overflow][stackoverflow-mcve] and sometimes it is also called [SSCCE][sscce], a _Short, Self Contained, Correct (Compilable), Example_.
A MCVE is a common practice like on [Stack Overflow][stackoverflow-mcve] and sometimes it is also called [SSCCE][], a _Short, Self Contained, Correct (Compilable), Example_.

The recommended way for GitHub based projects is to create it as [Gist][gh-gist] or new repository, but of course you can [attach it to issues and pull requests as files][ghd-attach-file], use any free code paste- or file hosting service or paste the code in [Markdown code blocks][ghd-markdown-code-blocks] into the issue.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A style guide establishes and enforces style to improve the intelligibility and
### Getting Started

The [project documentation][docs] contains chapters to learn about
the [comprehensive base rule set][docs-rules] with support for [GitHub Flavored Markdown][gfm] which is based on the [CommonMark][commonmark] specification. It includes rules for all document elements like e.g. [code blocks][docs-rules-code-blocks], [headings][docs-rules-headings] or [lists][docs-rules-lists], defines [naming conventions][docs-rules-naming-conventions] and best practices for [whitespaces][docs-rules-whitespaces], [Raw HTML][docs-rules-raw-html], [emphasizing][docs-rules-emphasis] and [strings][docs-rules-strings].
the [comprehensive base rule set][docs-rules] with support for [GitHub Flavored Markdown][gfm] which is based on the [CommonMark][] specification. It includes rules for all document elements like e.g. [code blocks][docs-rules-code-blocks], [headings][docs-rules-headings] or [lists][docs-rules-lists], defines [naming conventions][docs-rules-naming-conventions] and best practices for [whitespaces][docs-rules-whitespaces], [Raw HTML][docs-rules-raw-html], [emphasizing][docs-rules-emphasis] and [strings][docs-rules-strings].

The development chapters contain information about the [requirements][docs-dev-requirements] and [how to build][docs-dev-building] the style guide documentation.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@
"lint-staged": "^10.5.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"remark-cli": "^5.0.0"
"remark-cli": "^9.0.0"
}
}
1 change: 1 addition & 0 deletions packages/@arcticicestudio/remark-preset-lint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/**
* Arctic Ice Studio Markdown Style Guide rules as an extensible remark-lint rule preset.
*
* @version 0.3.0
* @license MIT
* @author Arctic Ice Studio <development@arcticicestudio.com>
Expand Down
139 changes: 72 additions & 67 deletions packages/@arcticicestudio/remark-preset-lint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,76 +38,81 @@
"access": "public"
},
"dependencies": {
"remark-frontmatter": "^1.3.0",
"remark-lint": "^6.0.1",
"remark-lint-blockquote-indentation": "^1.0.1",
"remark-lint-checkbox-character-style": "^1.0.1",
"remark-lint-checkbox-content-indent": "^1.0.1",
"remark-lint-code-block-style": "^1.0.1",
"remark-lint-definition-case": "^1.0.1",
"remark-lint-definition-spacing": "^1.0.1",
"remark-lint-emphasis-marker": "^1.0.1",
"remark-lint-fenced-code-flag": "^1.0.1",
"remark-lint-fenced-code-marker": "^1.0.1",
"remark-lint-file-extension": "^1.0.1",
"remark-lint-final-definition": "^1.0.1",
"remark-lint-final-newline": "^1.0.1",
"remark-lint-first-heading-level": "^1.1.1",
"remark-lint-hard-break-spaces": "^1.0.2",
"remark-lint-heading-increment": "^1.0.1",
"remark-lint-heading-style": "^1.0.1",
"remark-lint-linebreak-style": "^1.0.1",
"remark-lint-link-title-style": "^1.0.1",
"remark-lint-list-item-bullet-indent": "^1.0.1",
"remark-lint-list-item-content-indent": "^1.0.1",
"remark-lint-list-item-indent": "^1.0.1",
"remark-lint-list-item-spacing": "^1.1.1",
"remark-lint-maximum-heading-length": "^1.0.1",
"remark-lint-maximum-line-length": "^1.0.2",
"remark-lint-no-auto-link-without-protocol": "^1.0.1",
"remark-lint-no-blockquote-without-marker": "^2.0.1",
"remark-lint-no-consecutive-blank-lines": "^1.0.1",
"remark-lint-no-duplicate-definitions": "^1.0.1",
"remark-lint-no-duplicate-headings": "^1.0.1",
"remark-lint-no-duplicate-headings-in-section": "^1.0.1",
"remark-lint-no-emphasis-as-heading": "^1.0.1",
"remark-lint-no-empty-url": "^1.0.2",
"remark-lint-no-file-name-articles": "^1.0.1",
"remark-lint-no-file-name-consecutive-dashes": "^1.0.1",
"remark-lint-no-file-name-irregular-characters": "^1.0.1",
"remark-lint-no-file-name-mixed-case": "^1.0.1",
"remark-lint-no-file-name-outer-dashes": "^1.0.2",
"remark-lint-no-heading-content-indent": "^1.0.1",
"remark-lint-no-heading-indent": "^1.0.1",
"remark-lint-no-heading-like-paragraph": "^1.0.1",
"remark-lint-no-heading-punctuation": "^1.0.1",
"remark-lint-no-html": "^1.0.1",
"remark-lint-no-inline-padding": "^1.0.1",
"remark-lint-no-literal-urls": "^1.0.1",
"remark-lint-no-missing-blank-lines": "^1.0.1",
"remark-lint-no-multiple-toplevel-headings": "^1.0.1",
"remark-lint-no-paragraph-content-indent": "^1.0.3",
"remark-lint-no-reference-like-url": "^1.0.1",
"remark-lint-no-shell-dollars": "^1.0.1",
"remark-lint-no-shortcut-reference-image": "^1.0.1",
"remark-lint-no-shortcut-reference-link": "^1.0.2",
"remark-lint-no-table-indentation": "^1.0.1",
"remark-lint-no-tabs": "^1.0.1",
"remark-lint-no-undefined-references": "^1.0.1",
"remark-lint-no-unused-definitions": "^1.0.1",
"remark-lint-ordered-list-marker-style": "^1.0.1",
"remark-lint-ordered-list-marker-value": "^1.0.1",
"remark-lint-rule-style": "^1.0.1",
"remark-lint-strong-marker": "^1.0.1",
"remark-lint-table-cell-padding": "^1.0.1",
"remark-lint-table-pipe-alignment": "^1.0.1",
"remark-lint-table-pipes": "^1.0.1",
"remark-lint-unordered-list-marker-style": "^1.0.1"
"remark-footnotes": "^3.0.0",
"remark-frontmatter": "^3.0.0",
"remark-gfm": "^1.0.0",
"remark-lint": "^8.0.0",
"remark-lint-blockquote-indentation": "^2.0.1",
"remark-lint-checkbox-character-style": "^3.0.0",
"remark-lint-checkbox-content-indent": "^3.0.0",
"remark-lint-code-block-style": "^2.0.1",
"remark-lint-definition-case": "^2.0.1",
"remark-lint-definition-spacing": "^2.0.1",
"remark-lint-emphasis-marker": "^2.0.1",
"remark-lint-fenced-code-flag": "^2.0.1",
"remark-lint-fenced-code-marker": "^2.0.1",
"remark-lint-file-extension": "^1.0.5",
"remark-lint-final-definition": "^2.1.0",
"remark-lint-final-newline": "^1.0.5",
"remark-lint-first-heading-level": "^2.0.1",
"remark-lint-hard-break-spaces": "^2.0.1",
"remark-lint-heading-increment": "^2.0.1",
"remark-lint-heading-style": "^2.0.1",
"remark-lint-linebreak-style": "^2.0.1",
"remark-lint-link-title-style": "^2.0.1",
"remark-lint-list-item-bullet-indent": "^3.0.0",
"remark-lint-list-item-content-indent": "^2.0.1",
"remark-lint-list-item-indent": "^2.0.1",
"remark-lint-list-item-spacing": "^3.0.0",
"remark-lint-maximum-heading-length": "^2.0.1",
"remark-lint-maximum-line-length": "^2.0.3",
"remark-lint-no-auto-link-without-protocol": "^2.0.1",
"remark-lint-no-blockquote-without-marker": "^4.0.0",
"remark-lint-no-consecutive-blank-lines": "^3.0.0",
"remark-lint-no-duplicate-defined-urls": "^1.0.1",
"remark-lint-no-duplicate-definitions": "^2.0.1",
"remark-lint-no-duplicate-headings": "^2.0.1",
"remark-lint-no-duplicate-headings-in-section": "^2.0.2",
"remark-lint-no-emphasis-as-heading": "^2.0.1",
"remark-lint-no-empty-url": "^2.0.1",
"remark-lint-no-file-name-articles": "^1.0.5",
"remark-lint-no-file-name-consecutive-dashes": "^1.0.5",
"remark-lint-no-file-name-irregular-characters": "^1.0.5",
"remark-lint-no-file-name-mixed-case": "^1.0.5",
"remark-lint-no-file-name-outer-dashes": "^1.0.6",
"remark-lint-no-heading-content-indent": "^3.0.0",
"remark-lint-no-heading-indent": "^3.0.0",
"remark-lint-no-heading-like-paragraph": "^2.0.1",
"remark-lint-no-heading-punctuation": "^2.0.1",
"remark-lint-no-html": "^2.0.1",
"remark-lint-no-inline-padding": "^3.0.0",
"remark-lint-no-literal-urls": "^2.0.1",
"remark-lint-no-missing-blank-lines": "^2.0.1",
"remark-lint-no-multiple-toplevel-headings": "^2.0.1",
"remark-lint-no-paragraph-content-indent": "^3.0.0",
"remark-lint-no-reference-like-url": "^2.0.1",
"remark-lint-no-shell-dollars": "^2.0.2",
"remark-lint-no-shortcut-reference-image": "^2.0.1",
"remark-lint-no-shortcut-reference-link": "^2.0.1",
"remark-lint-no-table-indentation": "^3.0.0",
"remark-lint-no-tabs": "^2.0.1",
"remark-lint-no-undefined-references": "^3.0.0",
"remark-lint-no-unneeded-full-reference-image": "^2.0.1",
"remark-lint-no-unneeded-full-reference-link": "^2.0.1",
"remark-lint-no-unused-definitions": "^2.0.1",
"remark-lint-ordered-list-marker-style": "^2.0.1",
"remark-lint-ordered-list-marker-value": "^2.0.1",
"remark-lint-rule-style": "^2.0.1",
"remark-lint-strong-marker": "^2.0.1",
"remark-lint-table-cell-padding": "^3.0.0",
"remark-lint-table-pipe-alignment": "^2.0.1",
"remark-lint-table-pipes": "^3.0.0",
"remark-lint-unordered-list-marker-style": "^2.0.1"
},
"devDependencies": {
"remark-cli": "^5.0.0"
"remark-cli": "^9.0.0"
},
"peerDependencies": {
"remark-cli": "^5.0.0"
"remark-cli": "^9.0.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const noBlockquoteWithoutMarker = require("remark-lint-no-blockquote-without-mar

/**
* Official remark-lint core rules for blockquote document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
4 changes: 1 addition & 3 deletions packages/@arcticicestudio/remark-preset-lint/rules/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ const noShellDollars = require("remark-lint-no-shell-dollars");

/**
* Official remark-lint core rules for code document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const strongMarker = require("remark-lint-strong-marker");

/**
* Official remark-lint core rules for emphasis document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ const noMultipleToplevelHeadings = require("remark-lint-no-multiple-toplevel-hea

/**
* Official remark-lint core rules for heading document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const ruleStyle = require("remark-lint-rule-style");

/**
* Official remark-lint core rules for horizontal rule document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
30 changes: 27 additions & 3 deletions packages/@arcticicestudio/remark-preset-lint/rules/links.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ const noAutoLinkWithoutProtocol = require("remark-lint-no-auto-link-without-prot
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/links.html#unique-ids
*/
const noDuplicateDefinitions = require("remark-lint-no-duplicate-definitions");
/**
* Warn when definitions define the same URL.
*
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-duplicate-defined-urls
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/links.html#unique-ids
*/
const noDuplicateDefinedURLs = require("remark-lint-no-duplicate-defined-urls");
/**
* Disallow empty link and image URLs.
*
Expand Down Expand Up @@ -85,12 +92,26 @@ const noUndefinedReferences = require("remark-lint-no-undefined-references");
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/links.html#no-unused
*/
const noUnusedDefinitions = require("remark-lint-no-unused-definitions");
/**
* Warn when full reference images are used that could be collapsed.
*
* @since 0.4.0
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unneeded-full-reference-image
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/images.html#collapsed-reference-links
*/
const noUnneededFullReferenceImage = require("remark-lint-no-unneeded-full-reference-image");
/**
* Warn when full reference links are used that could be collapsed.
*
* @since 0.4.0
* @see https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unneeded-full-reference-link
* @see https://arcticicestudio.github.io/styleguide-markdown/rules/links.html#collapsed-references
*/
const noUnneededFullReferenceLink = require("remark-lint-no-unneeded-full-reference-link");

/**
* Official remark-lint core rules for link document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand All @@ -100,12 +121,15 @@ module.exports = {
[finalDefinition, ["error"]],
[noAutoLinkWithoutProtocol, ["warn"]],
[noDuplicateDefinitions, ["error"]],
[noDuplicateDefinedURLs, ["warn"]],
[noEmptyUrl, ["error"]],
[noLiteralUrls, false],
[noReferenceLikeUrl, ["error"]],
[noShortcutReferenceImage, false],
[noShortcutReferenceLink, false],
[noUndefinedReferences, ["error"]],
[noUnusedDefinitions, ["warn"]],
[noUnneededFullReferenceImage, ["warn"]],
[noUnneededFullReferenceLink, ["warn"]],
],
};
4 changes: 1 addition & 3 deletions packages/@arcticicestudio/remark-preset-lint/rules/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ const unorderedListMarkerStyle = require("remark-lint-unordered-list-marker-styl

/**
* Official remark-lint core rules for list document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ const noFileNameOuterDashes = require("remark-lint-no-file-name-outer-dashes");

/**
* Official remark-lint core rules for naming conventions.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const noParagraphContentIndent = require("remark-lint-no-paragraph-content-inden

/**
* Official remark-lint core rules for paragraph document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const noHtml = require("remark-lint-no-html");

/**
* Official remark-lint core rules for raw HTML document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const linkTitleStyle = require("remark-lint-link-title-style");

/**
* Official remark-lint core rules for string document nodes.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @since 0.1.0
*
* @see https://github.com/remarkjs/remark-lint/blob/main/doc/rules.md#list-of-rules
*/
module.exports = {
Expand Down
Loading

0 comments on commit 9ff968f

Please sign in to comment.