Compare commits

...

210 commits

Author SHA1 Message Date
David Anson
224987d727 Update to version 0.38.0. 2025-05-02 20:22:08 -07:00
dependabot[bot]
8cb8f6c695 Bump @eslint/js from 9.25.1 to 9.26.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.25.1 to 9.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.26.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.26.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-02 20:21:39 -07:00
dependabot[bot]
a1506e71f3 Bump eslint from 9.25.1 to 9.26.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.25.1 to 9.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.25.1...v9.26.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.26.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-02 20:21:14 -07:00
dependabot[bot]
b3935080e9 Bump ava from 6.2.0 to 6.3.0
Bumps [ava](https://github.com/avajs/ava) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/avajs/ava/releases)
- [Commits](https://github.com/avajs/ava/compare/v6.2.0...v6.3.0)

---
updated-dependencies:
- dependency-name: ava
  dependency-version: 6.3.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-02 20:16:27 -07:00
David Anson
738f4aa59a Update test repo snapshots. 2025-05-03 03:11:31 +00:00
David Anson
979419c7a0 Remove support for end-of-life Node 18 (continued). 2025-05-01 22:20:41 -07:00
David Anson
4d8e79d33e Remove support for end-of-life Node 18 (continued). 2025-05-01 22:13:20 -07:00
David Anson
6adfaf68b5 Update MD025/single-title and MD051/link-fragments to ignore headings that exactly match Docfx tab syntax (fixes #1099) (fixes #1101). 2025-05-01 22:09:36 -07:00
David Anson
a4b7ffa8ce Remove support for end-of-life Node 18. 2025-05-01 21:20:18 -07:00
David Anson
f34f4dde69 Update Checkers workflow to ignore all github.com links because they return HTTP 429 randomly and linkinator does not handle that well. 2025-05-01 21:20:18 -07:00
David Anson
2775534144 Add retry:true for linkinator-action to retry for random GitHub HTTP 429 errors. 2025-05-01 21:15:47 -07:00
David Anson
006b6af736 Update test repo snapshots. 2025-05-02 04:03:04 +00:00
David Anson
328506e6c8 Update MD052/reference-links-images to add ignored_labels parameter and default to ignoring GFM task list items (fixes #1524). 2025-04-27 22:36:07 -07:00
dependabot[bot]
c413ac9a88 Bump eslint-plugin-jsdoc from 50.6.10 to 50.6.11
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.10 to 50.6.11.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.10...v50.6.11)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 50.6.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-27 21:52:41 -07:00
dependabot[bot]
9849e2871f Bump eslint-plugin-unicorn from 58.0.0 to 59.0.0
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 58.0.0 to 59.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v58.0.0...v59.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-version: 59.0.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-27 21:46:10 -07:00
dependabot[bot]
2a85b3c3f1 Bump webpack from 5.99.6 to 5.99.7
Bumps [webpack](https://github.com/webpack/webpack) from 5.99.6 to 5.99.7.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.99.6...v5.99.7)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.7
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-27 21:45:36 -07:00
David Anson
b611eba684 Update MD045/no-alt-text to allow violations when an HTML IMG has aria-hidden set to true (fixes #1576). 2025-04-27 18:42:36 -07:00
David Anson
faf96d513b Update test repo snapshots. 2025-04-28 01:40:18 +00:00
dependabot[bot]
318b9ff6b4 Bump eslint-plugin-jsdoc from 50.6.9 to 50.6.10
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.9 to 50.6.10.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.9...v50.6.10)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 50.6.10
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-23 21:16:14 -07:00
David Anson
e93b9854dc Update test repo snapshots. 2025-04-24 04:11:50 +00:00
dependabot[bot]
f6087f0e6a Bump @eslint/js from 9.25.0 to 9.25.1
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.25.0 to 9.25.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.25.1/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.25.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 19:59:22 -07:00
dependabot[bot]
1dc4974191 Bump eslint from 9.25.0 to 9.25.1
Bumps [eslint](https://github.com/eslint/eslint) from 9.25.0 to 9.25.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.25.0...v9.25.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.25.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 19:59:06 -07:00
David Anson
647dac621f Update test repo snapshots. 2025-04-22 02:53:37 +00:00
dependabot[bot]
fb8b562c94 Bump @eslint/js from 9.24.0 to 9.25.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.24.0 to 9.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.25.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.25.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-20 19:58:08 -07:00
dependabot[bot]
91eba5470a Bump eslint from 9.24.0 to 9.25.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.24.0 to 9.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.24.0...v9.25.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.25.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-20 19:57:41 -07:00
dependabot[bot]
4c6672d24d Bump webpack from 5.99.5 to 5.99.6
Bumps [webpack](https://github.com/webpack/webpack) from 5.99.5 to 5.99.6.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.99.5...v5.99.6)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-20 19:57:26 -07:00
David Anson
92cd6d51cb Add tests for previous commit to avoid invoking Micromark parser when not needed, improve type definitions slightly (closes #1564). 2025-04-20 04:59:27 +00:00
Yury Puzynya
759c31760e Avoid invoking Micromark parser when no Micromark-based rules are in effect. 2025-04-20 04:58:27 +00:00
David Anson
00fef38119 Update test repo snapshots. 2025-04-20 03:02:20 +00:00
dependabot[bot]
e40ed300d0 Bump webpack from 5.99.1 to 5.99.5
Bumps [webpack](https://github.com/webpack/webpack) from 5.99.1 to 5.99.5.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.99.1...v5.99.5)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 20:16:29 -07:00
dependabot[bot]
2ab8b49b48 Bump webpack from 5.98.0 to 5.99.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.98.0 to 5.99.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.98.0...v5.99.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-version: 5.99.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-07 19:46:38 -07:00
dependabot[bot]
75003eb741 Bump @eslint/js from 9.23.0 to 9.24.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.23.0 to 9.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.24.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.24.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-06 19:56:47 -07:00
dependabot[bot]
c17bfc5c17 Bump eslint from 9.23.0 to 9.24.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.23.0 to 9.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.23.0...v9.24.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.24.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-06 19:56:30 -07:00
dependabot[bot]
40a252d028 Bump typescript from 5.8.2 to 5.8.3
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.8.2 to 5.8.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml)
- [Commits](https://github.com/microsoft/TypeScript/commits)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 5.8.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-06 19:35:56 -07:00
David Anson
02478d24cf Update MD051/link-fragments to add the ignored_pattern configuration parameter (fixes #547). 2025-04-05 22:35:07 -07:00
David Anson
45932c7837 Update test repo snapshots. 2025-04-06 04:50:42 +00:00
David Anson
3145b68bed Update test repo snapshots. 2025-04-03 04:44:54 +00:00
David Anson
a84f7c5b18 Add mention of using "extends" in .markdownlint.json to reference installed packages (closes #1555). 2025-04-02 21:34:10 -07:00
David Anson
a9417fdf67 Update MD036/no-emphasis-as-heading to ignore HTML comments at the beginning or ending of the emphasised heading (fixes #1267). 2025-03-30 17:30:21 -07:00
David Anson
b4204f197e Add npm script "update-test-repos" to recreate the test-repos directory and freshen the corresponding snapshots. 2025-03-31 00:12:46 +00:00
dependabot[bot]
465fc448eb Bump eslint-plugin-n from 17.16.2 to 17.17.0
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.16.2 to 17.17.0.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.16.2...v17.17.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-26 20:18:47 -07:00
David Anson
918f15945b Update test repo snapshots. 2025-03-27 03:07:57 +00:00
dependabot[bot]
c4a6ef42a6 Bump eslint-plugin-unicorn from 57.0.0 to 58.0.0
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 57.0.0 to 58.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v57.0.0...v58.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 20:36:20 -07:00
dependabot[bot]
32d660c34b Bump eslint from 9.22.0 to 9.23.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.22.0 to 9.23.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.22.0...v9.23.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-23 20:24:43 -07:00
dependabot[bot]
61fab7ba24 Bump @eslint/js from 9.22.0 to 9.23.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.22.0 to 9.23.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.23.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-23 20:07:27 -07:00
dependabot[bot]
41357b551f Bump eslint-plugin-jsdoc from 50.6.8 to 50.6.9
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.8 to 50.6.9.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.8...v50.6.9)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-23 20:07:09 -07:00
David Anson
62dc79864d Update MD041/first-line-heading to add an allow_preamble parameter (fixes #1416). 2025-03-22 16:16:10 -07:00
David Anson
c061888937 Update test repo snapshots. 2025-03-22 23:09:07 +00:00
dependabot[bot]
031c7be4db Bump eslint-plugin-jsdoc from 50.6.6 to 50.6.8
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.6 to 50.6.8.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.6...v50.6.8)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-17 20:32:37 -07:00
David Anson
0916d178e7 Update test repo snapshots. 2025-03-18 03:26:31 +00:00
David Anson
9b46692b8d Refactor build-config-schema.mjs slightly to reuse code. 2025-03-17 20:10:25 -07:00
David Anson
95f82760ce Update MD041/first-line-heading to avoid scanning every token with Array.filter. 2025-03-16 20:04:14 -07:00
David Anson
8baa843ce3 Update test repo snapshots. 2025-03-16 01:04:18 +00:00
David Anson
5fc91f6977 Update MD025/single-title to ignore preceding blank lines and comments when looking for a title (top-level heading) (fixes #1420). 2025-03-15 17:52:22 -07:00
David Anson
cb39972d9b Update test repo snapshots. 2025-03-16 00:14:52 +00:00
David Anson
50300fa7af Update MD051/link-fragments to allow HTML's implicit "#top" fragment (fixes #1488). 2025-03-15 16:30:32 -07:00
David Anson
5749c8dcf7 Update MD043/required-headings to support "?" meaning "exactly one unspecified heading" (fixes #475). 2025-03-10 21:57:39 -07:00
dependabot[bot]
06b60b7372 Bump eslint-plugin-jsdoc from 50.6.3 to 50.6.6
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.3 to 50.6.6.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.3...v50.6.6)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 21:38:08 -07:00
dependabot[bot]
a3db3dba2d Bump eslint from 9.21.0 to 9.22.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.21.0 to 9.22.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.21.0...v9.22.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 21:25:38 -07:00
dependabot[bot]
917c5a5f1d Bump @eslint/js from 9.21.0 to 9.22.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.21.0 to 9.22.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.22.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 21:25:17 -07:00
David Anson
61febde9c1 Update test repo snapshots. 2025-03-11 04:15:33 +00:00
David Anson
d4a8a3bdfa Update new exports test to filter out module.exports to keep snapshot consistent between Node 22 (missing) and 23 (present). 2025-03-06 20:32:31 -08:00
David Anson
5cc88a7759 Add test to verify exported names are stable, add missing test files after earlier refactor. 2025-03-06 20:24:33 -08:00
dependabot[bot]
d4a638101a Bump terser-webpack-plugin from 5.3.13 to 5.3.14
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 5.3.13 to 5.3.14.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.3.13...v5.3.14)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-06 20:14:39 -08:00
David Anson
087df4480e Update test repo snapshots. 2025-03-07 03:59:23 +00:00
dependabot[bot]
7b4c958e48 Bump terser-webpack-plugin from 5.3.12 to 5.3.13
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 5.3.12 to 5.3.13.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.3.12...v5.3.13)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 20:06:56 -08:00
David Anson
d5cb5c8546 Update getHeadingText helper to exclude HTML comments from returned heading text (fixes #1411). 2025-03-04 21:04:33 -08:00
dependabot[bot]
d36a57d680 Bump eslint-plugin-n from 17.15.1 to 17.16.2
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.15.1 to 17.16.2.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.15.1...v17.16.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-04 20:57:52 -08:00
David Anson
f0b1afe884 Update test repo snapshots. 2025-03-05 04:42:49 +00:00
David Anson
435c55f72a Update MD027/no-multiple-space-blockquote to add a list_items parameter (fixes #1473). 2025-03-03 23:22:37 -08:00
David Anson
d02090db2c Remove outdated use of "@ts-expect-error https://github.com/microsoft/TypeScript/issues/52529". 2025-03-03 22:57:01 -08:00
dependabot[bot]
dbf828c493 Bump typescript from 5.7.3 to 5.8.2
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.3 to 5.8.2.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.3...v5.8.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 22:57:01 -08:00
dependabot[bot]
965b642109 Bump @stylistic/eslint-plugin from 4.1.0 to 4.2.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v4.2.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 20:17:39 -08:00
David Anson
14cf2454ae Make new test further backward-compatible for testing Node versions < 22. 2025-03-01 19:28:23 -08:00
David Anson
a5e2134147 Make new test backward-compatible for testing Node versions < 22. 2025-03-01 18:31:06 -08:00
David Anson
63147ee1eb Add comprehensive tests for parseConfiguration function, handle non-object parser results consistently (fixes #1523). 2025-03-01 18:23:48 -08:00
David Anson
1f237e6c54 Refactor to move parseConfiguration function into a separate file, add stronger typing, add first test case. 2025-02-28 20:26:06 -08:00
David Anson
c4d15e0d2a Update test repo snapshots. 2025-03-01 04:15:05 +00:00
David Anson
27d70632cd Update GitHub issue template for GitHub behavioral changes. 2025-02-28 19:48:52 -08:00
dependabot[bot]
55941a5627 Bump micromark from 4.0.1 to 4.0.2
Bumps [micromark](https://github.com/micromark/micromark) from 4.0.1 to 4.0.2.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/4.0.1...4.0.2)

---
updated-dependencies:
- dependency-name: micromark
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 19:39:58 -08:00
dependabot[bot]
1c4f69a7fc Bump micromark-core-commonmark from 2.0.2 to 2.0.3
Bumps [micromark-core-commonmark](https://github.com/micromark/micromark) from 2.0.2 to 2.0.3.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/micromark-build@2.0.2...micromark-core-commonmark@2.0.3)

---
updated-dependencies:
- dependency-name: micromark-core-commonmark
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 19:18:46 -08:00
dependabot[bot]
5d3d07d345 Bump micromark-util-types from 2.0.1 to 2.0.2
Bumps [micromark-util-types](https://github.com/micromark/micromark) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/micromark-build@2.0.1...micromark-util-types@2.0.2)

---
updated-dependencies:
- dependency-name: micromark-util-types
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 19:12:17 -08:00
dependabot[bot]
909b9a75ae Bump micromark-extension-directive from 3.0.2 to 4.0.0
Bumps [micromark-extension-directive](https://github.com/micromark/micromark-extension-directive) from 3.0.2 to 4.0.0.
- [Release notes](https://github.com/micromark/micromark-extension-directive/releases)
- [Commits](https://github.com/micromark/micromark-extension-directive/compare/3.0.2...4.0.0)

---
updated-dependencies:
- dependency-name: micromark-extension-directive
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 19:12:02 -08:00
dependabot[bot]
eaa1c74a11 Bump terser-webpack-plugin from 5.3.11 to 5.3.12
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 5.3.11 to 5.3.12.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.3.11...v5.3.12)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-27 18:57:15 -08:00
Edd Wilder-James
d918f61c77
Add "flymake-markdownlint-cli2 extension for Emacs" to "Related" section of README.md. 2025-02-27 18:48:28 -08:00
David Anson
14524283cc Update test repo snapshots. 2025-02-28 02:30:40 +00:00
dependabot[bot]
6645868510 Bump @stylistic/eslint-plugin from 4.0.1 to 4.1.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 4.0.1 to 4.1.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v4.1.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-26 19:35:39 -08:00
dependabot[bot]
a2d569b012 Bump markdownlint-rule-extended-ascii from 0.1.0 to 0.2.1
Bumps [markdownlint-rule-extended-ascii](https://github.com/DavidAnson/markdownlint-rule-extended-ascii) from 0.1.0 to 0.2.1.
- [Commits](https://github.com/DavidAnson/markdownlint-rule-extended-ascii/compare/v0.1.0...v0.2.1)

---
updated-dependencies:
- dependency-name: markdownlint-rule-extended-ascii
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 18:40:16 -08:00
David Anson
d53e3ff46c Update test repo snapshots. 2025-02-26 02:32:19 +00:00
dependabot[bot]
264946920a Bump @eslint/js from 9.20.0 to 9.21.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.20.0 to 9.21.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.21.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-23 19:31:32 -08:00
dependabot[bot]
c30b59ae81 Bump eslint from 9.20.1 to 9.21.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.20.1 to 9.21.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.20.1...v9.21.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-23 19:31:13 -08:00
David Anson
a36f2dcf41 Update test repo snapshots. 2025-02-24 03:21:09 +00:00
dependabot[bot]
4b3626b5f2 Bump @stylistic/eslint-plugin from 3.1.0 to 4.0.1
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 3.1.0 to 4.0.1.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v4.0.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-19 21:55:54 -08:00
David Anson
715020de46 Update test repo snapshots. 2025-02-20 05:46:43 +00:00
David Anson
241fe5b51c Address violation of new lint rule unicorn/no-named-default. 2025-02-17 20:05:27 -08:00
dependabot[bot]
31e480ad05 Bump eslint-plugin-unicorn from 56.0.1 to 57.0.0
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 56.0.1 to 57.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v56.0.1...v57.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 20:05:27 -08:00
David Anson
41654fbb60 Update test repo snapshots. 2025-02-18 04:01:54 +00:00
David Anson
c39a2dd516 Add test case for MD059/descriptive-link-text with MD039/no-space-in-links. 2025-02-13 22:56:13 -08:00
David Anson
571c2353ea Update new rule MD059/descriptive-link-text for project-level consistency. 2025-02-13 22:11:42 -08:00
Kate Higa
b8374ec5d2 Add rule MD059/descriptive-link-text "Link text should be descriptive" (fixes #681). 2025-02-13 22:11:42 -08:00
dependabot[bot]
4117394250 Bump webpack from 5.97.1 to 5.98.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.97.1 to 5.98.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.97.1...v5.98.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-13 19:25:50 -08:00
dependabot[bot]
6f7307ae7b Bump eslint from 9.20.0 to 9.20.1
Bumps [eslint](https://github.com/eslint/eslint) from 9.20.0 to 9.20.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.20.0...v9.20.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-11 19:57:43 -08:00
dependabot[bot]
737ea4ec6d Bump @stylistic/eslint-plugin from 3.0.1 to 3.1.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 3.0.1 to 3.1.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v3.1.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-09 19:37:12 -08:00
dependabot[bot]
bae6f9c63e Bump eslint from 9.19.0 to 9.20.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.19.0 to 9.20.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.19.0...v9.20.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-09 19:36:41 -08:00
dependabot[bot]
aa4f080b3f Bump globby from 14.0.2 to 14.1.0
Bumps [globby](https://github.com/sindresorhus/globby) from 14.0.2 to 14.1.0.
- [Release notes](https://github.com/sindresorhus/globby/releases)
- [Commits](https://github.com/sindresorhus/globby/compare/v14.0.2...v14.1.0)

---
updated-dependencies:
- dependency-name: globby
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-09 19:32:04 -08:00
dependabot[bot]
f950936baa Bump @eslint/js from 9.19.0 to 9.20.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.19.0 to 9.20.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.20.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-09 19:31:26 -08:00
David Anson
44c302fe0b Allow options.markdownItFactory to be implemented asynchronously so the markdown-it parser import can be deferred. 2025-02-08 15:08:10 -08:00
David Anson
d4b981bcb3 Introduce options.markdownItFactory (and remove options.markdownItPlugins) so the markdown-it parser can be removed as a direct dependency because it is no longer used by default. 2025-02-08 15:08:06 -08:00
David Anson
3cbe1cb6c5 Refactor micromark parse code to stop using micromark's TokenizeContext.sliceSerialize (less well supported) in favor of Token.start/end.offset. 2025-02-08 14:43:38 -08:00
David Anson
b23fc96ab2 Refactor MD038/no-space-in-code to produce smaller/simpler edits and address an additional scenario. 2025-02-07 20:03:30 -08:00
David Anson
656254e64f Update test repo snapshots. 2025-02-06 05:04:04 +00:00
David Anson
c71e298d4b Add tests for MD038/no-space-in-code scenarios to capture current behavior and aid refactoring. 2025-02-05 20:51:22 -08:00
David Anson
90cf515ff0 Update MD038/no-space-in-code to allow code spans with only spaces (fixes #1481). 2025-02-02 21:36:35 -08:00
David Anson
2d2fafc58d Add test cases for lists inside blockquotes (refs #1473). 2025-01-31 22:09:40 -08:00
dependabot[bot]
f2a0bfe651 Bump eslint from 9.18.0 to 9.19.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.18.0 to 9.19.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.18.0...v9.19.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-29 23:36:53 -08:00
dependabot[bot]
37f96413dd Bump @eslint/js from 9.18.0 to 9.19.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.18.0 to 9.19.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.19.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-29 23:09:16 -08:00
dependabot[bot]
b0a267bf47 Bump micromark-extension-gfm-table from 2.1.0 to 2.1.1
Bumps [micromark-extension-gfm-table](https://github.com/micromark/micromark-extension-gfm-table) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/micromark/micromark-extension-gfm-table/releases)
- [Commits](https://github.com/micromark/micromark-extension-gfm-table/compare/2.1.0...2.1.1)

---
updated-dependencies:
- dependency-name: micromark-extension-gfm-table
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-29 22:39:06 -08:00
dependabot[bot]
9d2b4cb1cc Bump eslint-plugin-jsdoc from 50.6.2 to 50.6.3
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.2 to 50.6.3.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.2...v50.6.3)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-29 22:37:21 -08:00
dependabot[bot]
cb00a41ff3 Bump @stylistic/eslint-plugin from 2.13.0 to 3.0.1
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.13.0 to 3.0.1.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v3.0.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-29 22:37:10 -08:00
dependabot[bot]
079aba9012 Bump eslint-plugin-jsdoc from 50.6.1 to 50.6.2
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.1 to 50.6.2.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.1...v50.6.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-19 22:11:35 -08:00
David Anson
feca49e4f8 Move exports/subpath imports (uses exec) and project file tests (use shared glob) into separate test files for better parallelization. 2025-01-19 16:44:20 -08:00
David Anson
eb8a0a2b7c Pass COPYFILE_FICLONE to fs.copyFile in npm script helper for better file copy performance where possible. 2025-01-19 16:36:05 -08:00
David Anson
8dbfe965e9 Parallelize TypeScript declaration tests. 2025-01-19 16:36:05 -08:00
David Anson
4d4aab6bd4 Update "ci" npm script to run "build-demo" fully in parallel. 2025-01-19 16:36:03 -08:00
David Anson
a4c553a45a Update to version 0.37.4. 2025-01-14 23:39:35 -08:00
David Anson
53ff5c43f1 Stop using module.createRequire (problematic under webpack), incorporate and export resolveModule helper from markdownlint-cli2. 2025-01-14 23:30:09 -08:00
dependabot[bot]
a1da464618 Bump json-schema-to-typescript from 15.0.3 to 15.0.4
Bumps [json-schema-to-typescript](https://github.com/bcherny/json-schema-to-typescript) from 15.0.3 to 15.0.4.
- [Changelog](https://github.com/bcherny/json-schema-to-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bcherny/json-schema-to-typescript/commits)

---
updated-dependencies:
- dependency-name: json-schema-to-typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-14 19:50:26 -08:00
dependabot[bot]
e6ee4cc0b1 Bump @stylistic/eslint-plugin from 2.12.1 to 2.13.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.12.1 to 2.13.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.13.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-12 19:53:01 -08:00
dependabot[bot]
e272b10a90 Bump eslint from 9.17.0 to 9.18.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.17.0 to 9.18.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.17.0...v9.18.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-12 19:48:13 -08:00
dependabot[bot]
48336b7ed3 Bump @eslint/js from 9.17.0 to 9.18.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.17.0 to 9.18.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.18.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-12 19:47:46 -08:00
dependabot[bot]
a6cc4cc860 Bump typescript from 5.7.2 to 5.7.3
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.2 to 5.7.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.2...v5.7.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-09 18:46:49 -08:00
David Anson
4ad6628dcb Update test repo snapshots. 2025-01-10 02:36:21 +00:00
David Anson
637975f517 Update MD039/no-space-in-links to remove outdated validLink helper and simplify slightly. 2025-01-06 20:28:53 -08:00
David Anson
d4352c7a44 Update test repo snapshots. 2025-01-07 04:28:31 +00:00
David Anson
74b1c195e3 Update to version 0.37.3. 2024-12-30 19:48:55 -08:00
David Anson
ef70472df7 Make micromark-core-commonmark a direct dependency to satisfy strict dependency resolution (e.g., pnpm). 2024-12-31 03:36:56 +00:00
David Anson
795eac22de Add CI job that verifies tests pass when using pnpm (vs. npm). 2024-12-31 03:27:16 +00:00
David Anson
df33933fe5 Update export test to avoid "ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time". 2024-12-24 00:15:19 +00:00
dependabot[bot]
8e5f699bb2 Bump webpack-cli from 6.0.0 to 6.0.1
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 6.0.0 to 6.0.1.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@6.0.0...webpack-cli@6.0.1)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-22 22:04:28 -08:00
dependabot[bot]
92eb4254fc Bump eslint-plugin-n from 17.15.0 to 17.15.1
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.15.0 to 17.15.1.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.15.0...v17.15.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-22 22:02:59 -08:00
dependabot[bot]
1587927660 Bump webpack-cli from 5.1.4 to 6.0.0
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 5.1.4 to 6.0.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@5.1.4...webpack-cli@6.0.0)

---
updated-dependencies:
- dependency-name: webpack-cli
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-19 20:16:42 -08:00
David Anson
a1081ec450 Add "bundler" and "subpath" to dictionary.txt. 2024-12-18 21:38:39 -08:00
David Anson
5fad452106 Update to version 0.37.2. 2024-12-18 21:31:43 -08:00
David Anson
baf4944f5f Add subpath imports "markdownlint-imports-browser" and "markdownlint-imports-node" for overriding "browser"/"default" behavior in bundlers like webpack. 2024-12-17 21:21:57 -08:00
David Anson
8ad4698536 Update MD032/blanks-around-lists to ignore (end-appended) undefined reference tokens when determining the last line of a list (fixes #1453). 2024-12-16 20:54:37 -08:00
David Anson
599b687849 Use double quotes for HTML attribute of demo page containing JSON.stringify output (because that escapes double quotes but not single quotes and encodeURIComponent also ignores single quotes). 2024-12-16 20:14:33 -08:00
David Anson
e959c1e522 Correct spelling (case) of "webpack" in CHANGELOG.md. 2024-12-14 20:21:53 -08:00
David Anson
af086995ed Update to version 0.37.1. 2024-12-14 20:16:59 -08:00
dependabot[bot]
dc26c50688 Bump terser-webpack-plugin from 5.3.10 to 5.3.11
Bumps [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) from 5.3.10 to 5.3.11.
- [Release notes](https://github.com/webpack-contrib/terser-webpack-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/terser-webpack-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/terser-webpack-plugin/compare/v5.3.10...v5.3.11)

---
updated-dependencies:
- dependency-name: terser-webpack-plugin
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-14 20:11:11 -08:00
dependabot[bot]
5056da0f93 Bump @eslint/js from 9.16.0 to 9.17.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.16.0 to 9.17.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.17.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-14 20:10:52 -08:00
dependabot[bot]
a46b587900 Bump eslint from 9.16.0 to 9.17.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.16.0 to 9.17.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.16.0...v9.17.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-14 20:09:25 -08:00
David Anson
faa9c6cbb4 Remove outdated /micromark configuration for Dependabot. 2024-12-14 20:05:04 -08:00
dependabot[bot]
c9d32c33b0 Bump @stylistic/eslint-plugin from 2.12.0 to 2.12.1
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.12.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-11 19:14:14 -08:00
David Anson
a009407088 Add support for "browser" condition (e.g., as used by Webpack) by stubbing-away Node imports (fixes #1441). 2024-12-11 18:48:54 -08:00
David Anson
65eeb4c8d9 Suppress (hidden) expected Webpack warnings due to dynamic require and bundle size. 2024-12-10 21:56:14 -08:00
David Anson
8b26129d55 Convert types.d.mts from ambient module declaration to module augmentation which enables VS Code to handle @type {import("markdownlint").Rule} (https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules), fix broken markdownlint @typedefs in helpers/*.cjs. 2024-12-10 21:47:06 -08:00
dependabot[bot]
6737ace933 Bump eslint-plugin-jsdoc from 50.6.0 to 50.6.1
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.6.0 to 50.6.1.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.6.0...v50.6.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-10 19:15:52 -08:00
dependabot[bot]
259f19a558 Bump c8 from 10.1.2 to 10.1.3
Bumps [c8](https://github.com/bcoe/c8) from 10.1.2 to 10.1.3.
- [Release notes](https://github.com/bcoe/c8/releases)
- [Changelog](https://github.com/bcoe/c8/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bcoe/c8/compare/v10.1.2...v10.1.3)

---
updated-dependencies:
- dependency-name: c8
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-10 19:10:50 -08:00
dependabot[bot]
14d8db70f6 Bump eslint-plugin-n from 17.14.0 to 17.15.0
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.14.0 to 17.15.0.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.14.0...v17.15.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-10 19:10:24 -08:00
dependabot[bot]
ed3cd80bab Bump @stylistic/eslint-plugin from 2.11.0 to 2.12.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.11.0 to 2.12.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.12.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-09 19:49:45 -08:00
David Anson
898c573f29 Un-pin Node 23 version in ci.yml. 2024-12-08 18:35:05 -08:00
David Anson
015b34ff09 Update helpers to version 0.28.0. 2024-12-07 18:23:52 -08:00
David Anson
62073a8fde Update to version 0.37.0. 2024-12-07 18:12:13 -08:00
David Anson
6e52643f8c Update CHANGELOG.md for breaking changes, remove outdated comments from test file. 2024-12-05 23:00:55 -08:00
David Anson
2449163ffb Add engine-strict=true to .npmrc to catch Node versioning issues with dependencies. 2024-12-05 22:20:06 -08:00
dependabot[bot]
fd7fb925a9 Bump webpack from 5.97.0 to 5.97.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.97.0 to 5.97.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.97.0...v5.97.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-05 19:31:27 -08:00
David Anson
ce7efbd9e1 Update CHANGELOG.md for ESM, add links for guidance. 2024-12-04 23:33:44 -08:00
David Anson
b404c8bf16 Add README documentation for getVersion, leave promise/extendConfig undocumented (unsupported). 2024-12-04 23:23:56 -08:00
David Anson
8da43dd246 Update to use named exports via / /async /promise /sync, simplify references via self-referencing, refine examples. 2024-12-03 19:58:47 -08:00
dependabot[bot]
e41f034bef Bump webpack from 5.96.1 to 5.97.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.96.1 to 5.97.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.96.1...v5.97.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-03 18:11:54 -08:00
dependabot[bot]
853c142291 Bump eslint from 9.15.0 to 9.16.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.15.0 to 9.16.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.15.0...v9.16.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-01 23:55:21 -08:00
dependabot[bot]
69242b3aa6 Bump @eslint/js from 9.15.0 to 9.16.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.15.0 to 9.16.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.16.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-01 21:29:29 -08:00
dependabot[bot]
4965ee84e4 Bump micromark-util-types from 2.0.0 to 2.0.1
Bumps [micromark-util-types](https://github.com/micromark/micromark) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/micromark-util-types@2.0.0...micromark-build@2.0.1)

---
updated-dependencies:
- dependency-name: micromark-util-types
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-01 21:29:06 -08:00
dependabot[bot]
8f66aafe28 Bump micromark from 4.0.0 to 4.0.1
Bumps [micromark](https://github.com/micromark/micromark) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/4.0.0...4.0.1)

---
updated-dependencies:
- dependency-name: micromark
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-01 21:28:46 -08:00
David Anson
789190962c Remove import of node:util and manually implement promisify (improves browser scenario), improve JSDoc typing. 2024-11-30 21:44:37 -08:00
David Anson
3599f694ba Move micromark-parse.mjs from helpers to library, remove all dependencies from helpers. 2024-11-30 20:42:14 -08:00
David Anson
1e71f6f44e Convert markdownlint library to an ECMAScript module, replace markdownlint-micromark with micromark, stop publishing (large) markdownlint-browser.js, see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c for guidance. 2024-11-29 18:29:21 -08:00
dependabot[bot]
191226f070 Bump eslint-plugin-jsdoc from 50.5.0 to 50.6.0
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.5.0 to 50.6.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.5.0...v50.6.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-26 22:17:02 -08:00
dependabot[bot]
41dda9e041 Bump @microsoft/api-extractor from 7.47.12 to 7.48.0 in /micromark
Bumps [@microsoft/api-extractor](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-extractor) from 7.47.12 to 7.48.0.
- [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/CHANGELOG.md)
- [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-extractor_v7.48.0/apps/api-extractor)

---
updated-dependencies:
- dependency-name: "@microsoft/api-extractor"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-24 20:03:44 -08:00
dependabot[bot]
07ef2bf804 Bump typescript from 5.6.3 to 5.7.2
Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.6.3 to 5.7.2.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v5.6.3...v5.7.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-24 20:03:32 -08:00
David Anson
e815e1a458 Simplify README.md slightly by reducing redundancy. 2024-11-23 19:04:28 -08:00
dependabot[bot]
9fe9f801dc Bump @microsoft/api-extractor from 7.47.11 to 7.47.12 in /micromark
Bumps [@microsoft/api-extractor](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-extractor) from 7.47.11 to 7.47.12.
- [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/CHANGELOG.md)
- [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-extractor_v7.47.12/apps/api-extractor)

---
updated-dependencies:
- dependency-name: "@microsoft/api-extractor"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 09:11:24 -08:00
dependabot[bot]
770bbce5d4 Bump eslint-plugin-n from 17.13.2 to 17.14.0
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.13.2 to 17.14.0.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.13.2...v17.14.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-22 09:11:03 -08:00
dependabot[bot]
587b830cb2 Bump @stylistic/eslint-plugin from 2.10.1 to 2.11.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.11.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-19 20:52:37 -08:00
dependabot[bot]
3812cba029 Bump eslint from 9.14.0 to 9.15.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.14.0 to 9.15.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.14.0...v9.15.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-19 20:52:06 -08:00
dependabot[bot]
6f76cd105d Bump eslint-plugin-unicorn from 56.0.0 to 56.0.1
Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 56.0.0 to 56.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v56.0.0...v56.0.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-unicorn
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-19 20:46:32 -08:00
David Anson
d536543344 Update test repo snapshots. 2024-11-20 04:33:58 +00:00
dependabot[bot]
4853cf4c31 Bump @eslint/js from 9.14.0 to 9.15.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.14.0 to 9.15.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.15.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-17 18:16:57 -08:00
dependabot[bot]
a25af76bbb Bump eslint-plugin-n from 17.13.1 to 17.13.2
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.13.1 to 17.13.2.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.13.1...v17.13.2)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-17 18:16:30 -08:00
dependabot[bot]
a22b432d8a Bump eslint-plugin-regexp from 2.6.0 to 2.7.0
Bumps [eslint-plugin-regexp](https://github.com/ota-meshi/eslint-plugin-regexp) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/ota-meshi/eslint-plugin-regexp/releases)
- [Changelog](https://github.com/ota-meshi/eslint-plugin-regexp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ota-meshi/eslint-plugin-regexp/compare/v2.6.0...v2.7.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-regexp
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-14 18:46:37 -08:00
dependabot[bot]
fe45e0110a Bump micromark from 4.0.0 to 4.0.1 in /micromark
Bumps [micromark](https://github.com/micromark/micromark) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/4.0.0...4.0.1)

---
updated-dependencies:
- dependency-name: micromark
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-13 20:04:41 -08:00
dependabot[bot]
1ace77f0b0 Bump eslint-plugin-jsdoc from 50.4.3 to 50.5.0
Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 50.4.3 to 50.5.0.
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Changelog](https://github.com/gajus/eslint-plugin-jsdoc/blob/main/.releaserc)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.4.3...v50.5.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jsdoc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-13 19:57:02 -08:00
dependabot[bot]
0092c5f189 Bump micromark-util-types from 2.0.0 to 2.0.1 in /micromark
Bumps [micromark-util-types](https://github.com/micromark/micromark) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/micromark/micromark/releases)
- [Commits](https://github.com/micromark/micromark/compare/micromark-util-types@2.0.0...micromark-build@2.0.1)

---
updated-dependencies:
- dependency-name: micromark-util-types
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-13 19:54:33 -08:00
David Anson
e07c66ae68 Pin CI version of Node 23 to 23.1 as 23.2 has been broken for more than a day. 2024-11-13 19:45:55 -08:00
David Anson
f29ca16c38 Update link to SublimeLinter-contrib-markdownlint due to persistent server outage. 2024-11-12 19:57:31 -08:00
dependabot[bot]
1737a6c672 Bump eslint-plugin-n from 17.13.0 to 17.13.1
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.13.0 to 17.13.1.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.13.0...v17.13.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-07 18:48:56 -08:00
dependabot[bot]
132ccbea03 Bump json-schema-to-typescript from 15.0.2 to 15.0.3
Bumps [json-schema-to-typescript](https://github.com/bcherny/json-schema-to-typescript) from 15.0.2 to 15.0.3.
- [Changelog](https://github.com/bcherny/json-schema-to-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bcherny/json-schema-to-typescript/commits)

---
updated-dependencies:
- dependency-name: json-schema-to-typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-07 18:48:41 -08:00
dependabot[bot]
3850a6dc60 Bump eslint-plugin-n from 17.12.0 to 17.13.0
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.12.0 to 17.13.0.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.12.0...v17.13.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-06 19:31:02 -08:00
dependabot[bot]
b91dfb539f Bump webpack from 5.96.0 to 5.96.1 in /micromark
Bumps [webpack](https://github.com/webpack/webpack) from 5.96.0 to 5.96.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.96.0...v5.96.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-03 19:20:09 -08:00
dependabot[bot]
a418847399 Bump @stylistic/eslint-plugin from 2.10.0 to 2.10.1
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.10.0 to 2.10.1.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.10.1/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-03 19:19:44 -08:00
dependabot[bot]
975e25fcf0 Bump webpack from 5.96.0 to 5.96.1
Bumps [webpack](https://github.com/webpack/webpack) from 5.96.0 to 5.96.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.96.0...v5.96.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-03 18:47:49 -08:00
dependabot[bot]
2beebd6fc5 Bump eslint from 9.13.0 to 9.14.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.13.0 to 9.14.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v9.13.0...v9.14.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-03 18:47:26 -08:00
dependabot[bot]
7ba8160e8c Bump @eslint/js from 9.13.0 to 9.14.0
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.13.0 to 9.14.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/commits/v9.14.0/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-03 18:47:07 -08:00
Nick Schonning
db409190ed ci: Add Node 23 2024-11-02 13:17:29 -07:00
dependabot[bot]
727518d1cf Bump webpack from 5.95.0 to 5.96.0 in /micromark
Bumps [webpack](https://github.com/webpack/webpack) from 5.95.0 to 5.96.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.95.0...v5.96.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 00:55:34 -07:00
dependabot[bot]
589ecbf720 Bump webpack from 5.95.0 to 5.96.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.95.0 to 5.96.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.95.0...v5.96.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-01 00:55:16 -07:00
dependabot[bot]
04b597ab90 Bump eslint-plugin-n from 17.11.1 to 17.12.0
Bumps [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) from 17.11.1 to 17.12.0.
- [Release notes](https://github.com/eslint-community/eslint-plugin-n/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint-community/eslint-plugin-n/compare/v17.11.1...v17.12.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-n
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-30 22:05:07 -07:00
dependabot[bot]
b6dda50e58 Bump @stylistic/eslint-plugin from 2.9.0 to 2.10.0
Bumps [@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/eslint-stylistic/eslint-stylistic/releases)
- [Changelog](https://github.com/eslint-stylistic/eslint-stylistic/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint-stylistic/eslint-stylistic/commits/v2.10.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@stylistic/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-30 22:04:51 -07:00
David Anson
886e00a8d5 Update test repo snapshots. 2024-10-31 04:49:49 +00:00
David Anson
0eedda0a6c Update MD027/no-multiple-space-blockquote to handle multiple lines of indented code inside a blockquote (fixes #1393). 2024-10-28 21:40:39 -07:00
266 changed files with 8818 additions and 12938 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1 @@
blank_issues_enabled: false

View file

@ -11,9 +11,3 @@ updates:
interval: "daily"
target-branch: "next"
versioning-strategy: "increase"
- package-ecosystem: "npm"
directory: "/micromark"
schedule:
interval: "daily"
target-branch: "next"
versioning-strategy: "increase"

View file

@ -16,6 +16,7 @@ blockquotes
Boostnote
br
br_spaces
bundler
changelog
Changelog
changelogs
@ -30,11 +31,13 @@ Config
config.
CVE-\d+-\d+
docs-util
ECMAScript
ES2015
ES6
ESLint
eslint-plugin-markdownlint
first-line-h1
flymake-markdownlint-cli2
formatter
fs
GFM
@ -94,6 +97,7 @@ setext_with_atx_closed
setext-style
single-h1
sublist
subpath
Super-Linter
TestCafe
TOML

View file

@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: JustinBeckwith/linkinator-action@v1.11.0
with:
linksToSkip: '^https://github.com/.*/search\?q= ^https://opensource.org/ ^https://unix.stackexchange.com/'
linksToSkip: '^https://github.com/ ^https://opensource.org/ ^https://unix.stackexchange.com/'
paths: '*.md doc/*.md helpers/*.md'
timeout: 60000

View file

@ -11,14 +11,13 @@ on:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
node-version: [ 18, 20, 22 ]
node-version: [ 20, 22, 23 ]
steps:
- uses: actions/checkout@v4
@ -30,11 +29,21 @@ jobs:
run: npm install --no-package-lock
- name: Run CI Tests
run: npm run ci
- name: Install markdownlint-micromark Dependencies
run: npm run install-micromark
- name: Build markdownlint-micromark
run: npm run build-micromark
- name: Install local markdownlint-micromark
run: npm install --no-package-lock ./micromark
- name: Test with local markdownlint-micromark
pnpm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use pnpm latest
uses: pnpm/action-setup@v4
with:
version: latest
- name: Use Node.js latest
uses: actions/setup-node@v4
with:
node-version: latest
- name: Install dependencies
run: pnpm install
- name: Run CI Tests
run: npm test

10
.gitignore vendored
View file

@ -1,16 +1,10 @@
coverage
demo/markdown-it.min.js
demo/markdownlint-browser.js
demo/markdownlint-browser.min.js
demo/micromark-browser.js
demo/micromark-html-browser.js
micromark/micromark.cjs
micromark/micromark.dev.cjs
micromark/micromark-browser.js
micromark/micromark-browser.dev.js
micromark/micromark-html-browser.js
micromark/micromark-html-browser.dev.js
node_modules
!test/node_modules
!test/rules/node_modules
npm-debug.log
test-repos
.DS_Store

View file

@ -5,13 +5,11 @@
.vscode
coverage
demo/*
!demo/markdownlint-browser.js
doc-build
eslint.config.mjs
example
micromark
npm-debug.log
schema/*.js
schema/*.mjs
scripts
test
test-repos

1
.npmrc
View file

@ -1,2 +1,3 @@
engine-strict=true
ignore-scripts=true
package-lock=false

View file

@ -1,5 +1,39 @@
# Changelog
## 0.38.0
- Add MD059/descriptive-link-text
- Improve MD025/MD027/MD036/MD038/MD041/MD043/MD045/MD051/MD052
- `markdown-it` parser no longer a production dependency (breaking change)
- Add `markdownItFactory` option, remove `markdownItPlugins` option
- Remove support for end-of-life Node version 18
- Improve performance
- Update dependencies
## 0.37.4
- Stop using `module.createRequire`, export `resolveModule`
## 0.37.3
- Tweak `package.json` dependencies to work with `pnpm`
## 0.37.2
- Add subpath imports for overriding default bundler behavior
- Improve MD032
## 0.37.1
- Add support for "browser" condition (as used by webpack)
## 0.37.0
- Convert module to ECMAScript (breaking change)
- <https://nodejs.org/docs/latest/api/esm.html>
- <https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c>
- Convert module to named exports (breaking change)
## 0.36.1
- Fix behavior of MD054

View file

@ -14,8 +14,8 @@ Match the coding style of the files you edit. Although everyone has their own
preferences and opinions, a pull request is not the right forum to debate them.
Do not add new [`dependencies` to `package.json`][dependencies]. The Markdown
parsers [`markdown-it`][markdown-it] and [`micromark`][micromark] are the
project's only dependencies.
parser [`micromark`][micromark] (and its extensions) is this project's only
dependency.
Package versions for `dependencies` and `devDependencies` should be specified
exactly (also known as "pinning"). The short explanation is that doing otherwise
@ -85,7 +85,6 @@ Thank you!
[custom-rules]: doc/CustomRules.md
[dependencies]: https://docs.npmjs.com/files/package.json#dependencies
[example-com]: https://en.wikipedia.org/wiki/Example.com
[markdown-it]: https://www.npmjs.com/package/markdown-it
[micromark]: https://www.npmjs.com/package/micromark
[new-rule]: https://github.com/DavidAnson/markdownlint/labels/new%20rule
[npm-scripts]: https://docs.npmjs.com/misc/scripts

263
README.md
View file

@ -24,7 +24,7 @@ for Markdown files. It was inspired by - and heavily influenced by - Mark
Harrison's [markdownlint][markdownlint-ruby] for Ruby. The initial rules, rule
documentation, and test cases came from that project.
`markdownlint` uses the [`micromark`][micromark] parser and honors the
`markdownlint` uses the [`micromark` parser][micromark] and honors the
[CommonMark][commonmark] specification for Markdown. It additionally supports
popular [GitHub Flavored Markdown (GFM)][gfm] syntax like autolinks and tables
as well as directives, footnotes, and math syntax - all implemented by
@ -55,6 +55,7 @@ as well as directives, footnotes, and math syntax - all implemented by
- [vscode-markdownlint extension for VS Code][vscode-markdownlint]
- [Sublime Text markdownlint for Sublime Text][sublimelinter]
- [coc-markdownlint extension for Vim/Neovim][coc]
- [flymake-markdownlint-cli2 extension for Emacs][emacs-flymake]
- Tooling
- [eslint-plugin-markdownlint for the ESLint analyzer][eslint-plugin]
- [grunt-markdownlint for the Grunt task runner][grunt-markdownlint]
@ -65,6 +66,7 @@ as well as directives, footnotes, and math syntax - all implemented by
[cake]: https://github.com/cake-contrib/Cake.Markdownlint
[coc]: https://github.com/fannheyward/coc-markdownlint
[emacs-flymake]: https://github.com/ewilderj/flymake-markdownlint-cli2
[eslint-plugin]: https://github.com/paweldrozd/eslint-plugin-markdownlint
[grunt-markdownlint]: https://github.com/sagiegurari/grunt-markdownlint
[markdownlint-cli]: https://github.com/igorshubovych/markdownlint-cli
@ -75,7 +77,7 @@ as well as directives, footnotes, and math syntax - all implemented by
[markdownlint-problem-matcher]: https://github.com/xt0rted/markdownlint-problem-matcher
[nodejs-extensions]: https://github.com/Lombiq/NodeJs-Extensions
[rubygems-mdl]: https://rubygems.org/gems/mdl
[sublimelinter]: https://packagecontrol.io/packages/SublimeLinter-contrib-markdownlint
[sublimelinter]: https://github.com/jonlabelle/SublimeLinter-contrib-markdownlint
[super-linter]: https://github.com/super-linter/super-linter
[vscode-markdownlint]: https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint
@ -146,6 +148,7 @@ playground for learning and exploring.
- **[MD055](doc/md055.md)** *table-pipe-style* - Table pipe style
- **[MD056](doc/md056.md)** *table-column-count* - Table column count
- **[MD058](doc/md058.md)** *blanks-around-tables* - Tables should be surrounded by blank lines
- **[MD059](doc/md059.md)** *descriptive-link-text* - Link text should be descriptive
<!-- markdownlint-restore -->
@ -165,7 +168,7 @@ To implement your own rules, refer to [CustomRules.md](doc/CustomRules.md).
Tags group related rules and can be used to enable/disable multiple
rules at once.
- **`accessibility`** - `MD045`
- **`accessibility`** - `MD045`, `MD059`
- **`atx`** - `MD018`, `MD019`
- **`atx_closed`** - `MD020`, `MD021`
- **`blank_lines`** - `MD012`, `MD022`, `MD031`, `MD032`, `MD047`
@ -183,7 +186,7 @@ rules at once.
- **`language`** - `MD040`
- **`line_length`** - `MD013`
- **`links`** - `MD011`, `MD034`, `MD039`, `MD042`, `MD051`, `MD052`, `MD053`,
`MD054`
`MD054`, `MD059`
- **`ol`** - `MD029`, `MD030`, `MD032`
- **`spaces`** - `MD018`, `MD019`, `MD020`, `MD021`, `MD023`
- **`spelling`** - `MD044`
@ -312,42 +315,41 @@ alternate formats.
### Linting
Standard asynchronous API:
Asynchronous API via `import { lint } from "markdownlint/async"`:
```javascript
/**
* Lint specified Markdown files.
*
* @param {Options} options Configuration options.
* @param {Options | null} options Configuration options.
* @param {LintCallback} callback Callback (err, result) function.
* @returns {void}
*/
function markdownlint(options, callback) { ... }
function lint(options, callback) { ... }
```
Synchronous API (for build scripts, etc.):
```javascript
/**
* Lint specified Markdown files synchronously.
*
* @param {Options} options Configuration options.
* @returns {LintResults} Results object.
*/
function markdownlint.sync(options) { ... }
```
Promise API (in the `promises` namespace like Node.js's
[`fs` Promises API](https://nodejs.org/api/fs.html#fs_fs_promises_api)):
Synchronous API via `import { lint } from "markdownlint/sync"`:
```javascript
/**
* Lint specified Markdown files.
*
* @param {Options} options Configuration options.
* @param {Options | null} options Configuration options.
* @returns {LintResults} Results object.
*/
function lint(options) { ... }
```
Promise API via `import { lint } from "markdownlint/promise"`:
```javascript
/**
* Lint specified Markdown files.
*
* @param {Options | null} options Configuration options.
* @returns {Promise<LintResults>} Results object.
*/
function markdownlint(options) { ... }
function lint(options) { ... }
```
#### options
@ -419,9 +421,9 @@ object.
See [ValidatingConfiguration.md](schema/ValidatingConfiguration.md) for ways to
use the JSON Schema to validate configuration.
For more advanced scenarios, styles can reference and extend other styles.
The `readConfig` and `readConfigSync` functions can be used to read such
styles.
For more advanced scenarios, styles can reference and build upon other styles
via the `extends` keyword and a file path or (installed) package name. The
`readConfig` function can be used to read such aggregate styles from code.
For example, assuming a `base.json` configuration file:
@ -547,7 +549,7 @@ Type: `Object` implementing the [file system API][node-fs-api]
In advanced scenarios, it may be desirable to bypass the default file system
API. If a custom file system implementation is provided, `markdownlint` will use
that instead of invoking `require("fs")`.
that instead of using `node:fs`.
Note: The only methods called are `readFile` and `readFileSync`.
@ -568,28 +570,43 @@ This setting can be useful in the presence of (custom) rules that encounter
unexpected syntax and fail. By enabling this option, the linting process
is allowed to continue and report any violations that were found.
##### options.markdownItPlugins
##### options.markdownItFactory
Type: `Array` of `Array` of `Function` and plugin parameters
Type: `Function` returning an instance of a [`markdown-it` parser][markdown-it]
Specifies additional [`markdown-it` plugins][markdown-it-plugin] to use when
parsing input. Plugins can be used to support additional syntax and features for
advanced scenarios. *Deprecated.*
Provides a factory function for creating instances of the `markdown-it` parser.
[markdown-it-plugin]: https://www.npmjs.com/search?q=keywords:markdown-it-plugin
Previous versions of the `markdownlint` library declared `markdown-it` as a
direct dependency. This function makes it possible to avoid that dependency
entirely. In cases where `markdown-it` is needed, the caller is responsible for
declaring the dependency and returning an instance from this factory. If any
[`markdown-it` plugins][markdown-it-plugin] are needed, they should be `use`d by
the caller before returning the `markdown-it` instance.
Each item in the top-level `Array` should be of the form:
For compatibility with previous versions of `markdownlint`, this function should
be similar to:
```javascript
[ require("markdown-it-plugin"), plugin_param_0, plugin_param_1, ... ]
import markdownIt from "markdown-it";
const markdownItFactory = () => markdownIt({ "html": true });
```
> Note that `markdown-it` plugins are only called when the `markdown-it` parser
> is invoked. None of the built-in rules use the `markdown-it` parser, so
> `markdown-it` plugins will only be invoked when one or more
> [custom rules][custom-rules] that use the `markdown-it` parser are present.
When an asynchronous implementation of `lint` is being invoked (e.g., via
`markdownlint/async` or `markdownlint/promise`), this function can return a
`Promise` in order to defer the import of `markdown-it`:
```javascript
const markdownItFactory = () => import("markdown-it").then((module) => module.default({ "html": true }));
```
> Note that this function is only invoked when a `markdown-it` parser is
> needed. None of the built-in rules use the `markdown-it` parser, so it is only
> invoked when one or more [custom rules][custom-rules] are present that use the
> `markdown-it` parser.
[custom-rules]: #custom-rules
[markdown-it]: https://github.com/markdown-it/markdown-it
[markdown-it-plugin]: https://www.npmjs.com/search?q=keywords:markdown-it-plugin
##### options.noInlineConfig
@ -661,22 +678,22 @@ uses rule aliases (ex: `no-hard-tabs`) instead of names (ex: `MD010`).
### Config
The `options.config` configuration object is simple and can be stored in a file
for readability and easy reuse. The `readConfig` and `readConfigSync` functions
load configuration settings and support the `extends` keyword for referencing
other files (see above).
for readability and easy reuse. The `readConfig` function loads configuration
settings and supports the `extends` keyword for referencing files or packages
(see above).
By default, configuration files are parsed as JSON (and named
`.markdownlint.json`). Custom parsers can be provided to handle other formats
like JSONC, YAML, and TOML.
Asynchronous API:
Asynchronous API via `import { readConfig } from "markdownlint/async"`:
```javascript
/**
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing function.
* @param {ConfigurationParser[] | ReadConfigCallback} [parsers] Parsing function(s).
* @param {Object} [fs] File system implementation.
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
* @returns {void}
@ -684,22 +701,21 @@ Asynchronous API:
function readConfig(file, parsers, fs, callback) { ... }
```
Synchronous API:
Synchronous API via `import { readConfig } from "markdownlint/sync"`:
```javascript
/**
* Read specified configuration file synchronously.
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
* @param {Object} [fs] File system implementation.
* @returns {Configuration} Configuration object.
*/
function readConfigSync(file, parsers, fs) { ... }
function readConfig(file, parsers, fs) { ... }
```
Promise API (in the `promises` namespace like Node.js's
[`fs` Promises API](https://nodejs.org/api/fs.html#fs_promises_api)):
Promise API via `import { readConfig } from "markdownlint/promise"`:
```javascript
/**
@ -751,7 +767,7 @@ Type: *Optional* `Object` implementing the [file system API][file-system-api]
In advanced scenarios, it may be desirable to bypass the default file system
API. If a custom file system implementation is provided, `markdownlint` will use
that instead of invoking `require("fs")`.
that instead of invoking `node:fs`.
Note: The only methods called are `readFile`, `readFileSync`, `access`, and
`accessSync`.
@ -772,7 +788,8 @@ Configuration object.
Rules that can be fixed automatically include a `fixInfo` property which is
outlined in the [documentation for custom rules](doc/CustomRules.md#authoring).
To apply fixes consistently, the `applyFix`/`applyFixes` methods may be used:
To apply fixes consistently, the `applyFix`/`applyFixes` methods may be used via
`import { applyFix, applyFixes } from "markdownlint"`:
```javascript
/**
@ -798,20 +815,44 @@ function applyFixes(input, errors) { ... }
Invoking `applyFixes` with the results of a call to lint can be done like so:
```javascript
const { "sync": markdownlintSync, applyFixes } = require("markdownlint");
import { applyFixes } from "markdownlint";
import { lint as lintSync } from "markdownlint/sync";
function fixMarkdownlintViolations(content) {
const fixResults = markdownlintSync({ strings: { content } });
return applyFixes(content, fixResults.content);
}
const results = lintSync({ "strings": { "content": original } });
const fixed = applyFixes(original, results.content);
```
### Miscellaneous
To get the [semantic version][semver] of the library, the `getVersion` method
can be used:
```javascript
/**
* Gets the (semantic) version of the library.
*
* @returns {string} SemVer string.
*/
function getVersion() { ... }
```
Invoking `getVersion` is simple:
```javascript
import { getVersion } from "markdownlint";
// Displays the library version
console.log(getVersion());
```
[semver]: https://semver.org
## Usage
Invoke `markdownlint` and use the `result` object's `toString` method:
Invoke `lint` and use the `result` object's `toString` method:
```javascript
const markdownlint = require("markdownlint");
import { lint as lintAsync } from "markdownlint/async";
const options = {
"files": [ "good.md", "bad.md" ],
@ -821,9 +862,9 @@ const options = {
}
};
markdownlint(options, function callback(err, result) {
if (!err) {
console.log(result.toString());
lintAsync(options, function callback(error, results) {
if (!error && results) {
console.log(results.toString());
}
});
```
@ -841,21 +882,22 @@ bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
```
Or invoke `markdownlint.sync` for a synchronous call:
Or as a synchronous call:
```javascript
const result = markdownlint.sync(options);
console.log(result.toString());
import { lint as lintSync } from "markdownlint/sync";
const results = lintSync(options);
console.log(results.toString());
```
To examine the `result` object directly:
To examine the `result` object directly via a `Promise`-based call:
```javascript
markdownlint(options, function callback(err, result) {
if (!err) {
console.dir(result, { "colors": true, "depth": null });
}
});
import { lint as lintPromise } from "markdownlint/promise";
const results = await lintPromise(options);
console.dir(results, { "colors": true, "depth": null });
```
Output:
@ -897,80 +939,10 @@ Output:
```
Integration with the [gulp](https://gulpjs.com/) build system is
straightforward:
```javascript
const gulp = require("gulp");
const through2 = require("through2");
const markdownlint = require("markdownlint");
gulp.task("markdownlint", function task() {
return gulp.src("*.md", { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{ "files": [ file.relative ] },
function callback(err, result) {
const resultString = (result || "").toString();
if (resultString) {
console.log(resultString);
}
next(err, file);
});
}));
});
```
Output:
```text
[00:00:00] Starting 'markdownlint'...
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
[00:00:00] Finished 'markdownlint' after 10 ms
```
straightforward: [`gulpfile.cjs`](example/gulpfile.cjs).
Integration with the [Grunt](https://gruntjs.com/) build system is similar:
```javascript
const markdownlint = require("markdownlint");
module.exports = function wrapper(grunt) {
grunt.initConfig({
"markdownlint": {
"example": {
"src": [ "*.md" ]
}
}
});
grunt.registerMultiTask("markdownlint", function task() {
const done = this.async();
markdownlint(
{ "files": this.filesSrc },
function callback(err, result) {
const resultString = err || ((result || "").toString());
if (resultString) {
grunt.fail.warn("\n" + resultString + "\n");
}
done(!err || !resultString);
});
});
};
```
Output:
```text
Running "markdownlint:example" (markdownlint) task
Warning:
bad.md: 3: MD010/no-hard-tabs Hard tabs [Column: 17]
bad.md: 1: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#bad.md"]
bad.md: 3: MD018/no-missing-space-atx No space after hash on atx style heading [Context: "#This file fails some rules."]
bad.md: 1: MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "#bad.md"]
Use --force to continue.
```
[`Gruntfile.cjs`](example/Gruntfile.cjs).
## Browser
@ -982,11 +954,9 @@ Generate normal and minified scripts with:
npm run build-demo
```
Then reference `markdownlint` and `micromark` scripts:
Then reference the `markdownlint-browser` script:
```html
<script src="demo/micromark-browser.js"></script>
<script src="demo/micromark-html-browser.js"></script>
<script src="demo/markdownlint-browser.min.js"></script>
```
@ -998,7 +968,8 @@ const options = {
"content": "Some Markdown to lint."
}
};
const results = window.markdownlint.sync(options).toString();
const results = globalThis.markdownlint.lintSync(options).toString();
```
## Examples

10
demo/browser-exports.mjs Normal file
View file

@ -0,0 +1,10 @@
// @ts-check
export { applyFixes, getVersion } from "markdownlint";
export { lint as lintSync } from "markdownlint/sync";
export { compile, parse, postprocess, preprocess } from "micromark";
export { directive, directiveHtml } from "micromark-extension-directive";
export { gfmAutolinkLiteral, gfmAutolinkLiteralHtml } from "micromark-extension-gfm-autolink-literal";
export { gfmFootnote, gfmFootnoteHtml } from "micromark-extension-gfm-footnote";
export { gfmTable, gfmTableHtml } from "micromark-extension-gfm-table";
export { math, mathHtml } from "micromark-extension-math";

View file

@ -34,8 +34,6 @@
</div>
</div>
<script src="markdown-it.min.js"></script>
<script src="micromark-browser.js"></script>
<script src="micromark-html-browser.js"></script>
<script src="markdownlint-browser.min.js"></script>
<script src="default.js"></script>
</body>

View file

@ -3,9 +3,8 @@
(function main() {
// Dependencies
var markdownit = globalThis.markdownit;
var markdownlint = globalThis.markdownlint.library;
var micromark = globalThis.micromarkBrowser;
var micromarkHtml = globalThis.micromarkHtmlBrowser;
var markdownlint = globalThis.markdownlint;
var micromark = markdownlint;
// DOM elements
var markdown = document.getElementById("markdown");
@ -70,15 +69,15 @@
const compileOptions = {
"allowDangerousHtml": true,
"htmlExtensions": [
micromarkHtml.directiveHtml({ "*": handleDirective }),
micromarkHtml.gfmAutolinkLiteralHtml(),
micromarkHtml.gfmFootnoteHtml(),
micromarkHtml.gfmTableHtml(),
micromarkHtml.mathHtml()
micromark.directiveHtml({ "*": handleDirective }),
micromark.gfmAutolinkLiteralHtml(),
micromark.gfmFootnoteHtml(),
micromark.gfmTableHtml(),
micromark.mathHtml()
]
};
try {
return micromarkHtml.compile(compileOptions)(events);
return micromark.compile(compileOptions)(events);
} catch (error) {
return `[Exception: "${error}"]`;
}
@ -113,7 +112,7 @@
},
"handleRuleFailures": true
};
allLintErrors = markdownlint.sync(options).content;
allLintErrors = markdownlint.lintSync(options).content;
violations.innerHTML = allLintErrors.map(function mapResult(result) {
var ruleName = result.ruleNames.slice(0, 2).join(" / ");
return "<em><a href='#line' target='" + result.lineNumber + "'>" +
@ -131,9 +130,9 @@
"\"</span>]" :
"") +
(result.fixInfo ?
" [<a href='#fix' target='" +
" [<a href='#fix' target=\"" +
encodeURIComponent(JSON.stringify(result)) +
"' class='detail'>Fix</a>]" :
"\" class='detail'>Fix</a>]" :
"");
}).join("<br/>");
}

File diff suppressed because it is too large Load diff

View file

@ -1,8 +0,0 @@
// @ts-check
"use strict";
module.exports = {
"library": require(".."),
"helpers": require("../helpers")
};

View file

@ -1,108 +0,0 @@
// @ts-check
"use strict";
const webpack = require("webpack");
const TerserPlugin = require("terser-webpack-plugin");
const nodeModulePrefixRe = /^node:/u;
function config(options) {
const { entry, filename, mode, optimization, packageJson } = options;
const { name, version, homepage, license } = packageJson;
return {
"devtool": false,
"entry": entry,
"externals": {
"markdown-it": "markdownit",
"markdownlint-micromark": "micromarkBrowser"
},
"mode": mode,
"module": {
"rules": [
{
"test": /\.[cm]?js$/,
"exclude": /node_modules/
}
]
},
"name": name,
"optimization": optimization,
"output": {
"filename": filename,
"library": {
"name": name.replace(/(-\w)/g, (m) => m.slice(1).toUpperCase()),
"type": "var"
},
"path": __dirname
},
"plugins": [
new webpack.NormalModuleReplacementPlugin(
nodeModulePrefixRe,
(resource) => {
const module = resource.request.replace(nodeModulePrefixRe, "");
resource.request = module;
}
),
new webpack.BannerPlugin({
"banner": `${name} ${version} ${homepage} @license ${license}`
})
],
"resolve": {
"fallback": {
"fs": false,
"os": false,
"path": false,
"util": false
}
}
};
}
const modeDevelopment = {
"mode": "development"
};
const modeProduction = {
"mode": "production",
"optimization": {
"minimizer": [
new TerserPlugin({
"extractComments": false,
"terserOptions": {
"compress": {
"passes": 2
}
}
})
]
}
};
const entryLibrary = {
"entry": "./markdownlint-exports.js",
"packageJson": require("../package.json")
};
// const entryHelpers = {
// "entry": "../helpers/helpers.js",
// "packageJson": require("../helpers/package.json")
// };
module.exports = [
config({
...entryLibrary,
...modeDevelopment,
"filename": "markdownlint-browser.js"
}),
config({
...entryLibrary,
...modeProduction,
"filename": "markdownlint-browser.min.js"
})
// config({
// ...entryHelpers,
// ...modeDevelopment,
// "filename": "markdownlint-rule-helpers-browser.js"
// }),
// config({
// ...entryHelpers,
// ...modeProduction,
// "filename": "markdownlint-rule-helpers-browser.min.js"
// })
];

81
demo/webpack.config.mjs Normal file
View file

@ -0,0 +1,81 @@
// @ts-check
import webpack from "webpack";
import TerserPlugin from "terser-webpack-plugin";
import { __dirname, importWithTypeJson } from "../test/esm-helpers.mjs";
const libraryPackageJson = await importWithTypeJson(import.meta, "../package.json");
// eslint-disable-next-line jsdoc/require-jsdoc
function config(options) {
const { entry, filename, mode, optimization, packageJson } = options;
const { name, version, homepage, license } = packageJson;
return {
"devtool": false,
"entry": entry,
"externals": {
"markdown-it": "markdownit"
},
"mode": mode,
"name": name,
"optimization": optimization,
"output": {
"filename": filename,
"library": {
"name": name.replace(/(-\w)/g, (m) => m.slice(1).toUpperCase()),
"type": "var"
},
"path": __dirname(import.meta)
},
"plugins": [
new webpack.BannerPlugin({
"banner": `${name} ${version} ${homepage} @license ${license}`
})
],
"ignoreWarnings": [
{
"message": /(asset|entrypoint) size limit/
},
{
"message": /dependencies cannot be statically extracted/
},
{
"message": /lazy load some parts of your application/
}
]
};
}
const modeDevelopment = {
"mode": "development"
};
const modeProduction = {
"mode": "production",
"optimization": {
"minimizer": [
new TerserPlugin({
"extractComments": false,
"terserOptions": {
"compress": {
"passes": 2
}
}
})
]
}
};
const entryLibrary = {
"entry": "./browser-exports.mjs",
"packageJson": libraryPackageJson
};
export default [
config({
...entryLibrary,
...modeDevelopment,
"filename": "markdownlint-browser.js"
}),
config({
...entryLibrary,
...modeProduction,
"filename": "markdownlint-browser.min.js"
})
];

View file

@ -1,8 +1,8 @@
import { readFile, writeFile } from "node:fs/promises";
import { EOL } from "node:os";
import { default as rules } from "../lib/rules.js";
import { newLineRe } from "../helpers/helpers.js";
import { deprecatedRuleNames, fixableRuleNames } from "../lib/constants.js";
import rules from "../lib/rules.mjs";
import { newLineRe } from "../helpers/helpers.cjs";
import { deprecatedRuleNames, fixableRuleNames } from "../lib/constants.mjs";
const maxLineLength = 80;

View file

@ -13,4 +13,8 @@ To fix, remove any extraneous space:
> indentation.
```
Inferring intended list indentation within a blockquote can be challenging;
setting the `list_items` parameter to `false` disables this rule for ordered
and unordered list items.
Rationale: Consistent formatting makes it easier to understand a document.

View file

@ -1,32 +1,44 @@
This rule is triggered for code span elements that have spaces adjacent to the
backticks:
This rule is triggered for code spans containing content with unnecessary space
next to the beginning or ending backticks:
```markdown
`some text `
` some text`
` some text `
```
To fix this, remove any spaces adjacent to the backticks:
To fix this, remove the extra space characters from the beginning and ending:
```markdown
`some text`
```
Note: A single leading and trailing space is allowed by the specification and
automatically trimmed (in order to allow for code spans that embed backticks):
Note: A single leading *and* trailing space is allowed by the specification and
trimmed by the parser to support code spans that begin or end with a backtick:
```markdown
`` `backticks` ``
`` backtick` ``
```
Note: A single leading or trailing space is allowed if used to separate code
span markers from an embedded backtick (though the space is not trimmed):
Note: When single-space padding is present in the input, it will be preserved
(even if unnecessary):
```markdown
`` ` embedded backtick``
` code `
```
Rationale: Violations of this rule are usually unintentional and may lead to
improperly-rendered content. If spaces beside backticks are intentional, this
rule can be disabled for that line or file.
Note: Code spans containing only spaces are allowed by the specification and are
also preserved:
```markdown
` `
` `
```
Rationale: Violations of this rule are usually unintentional and can lead to
improperly-rendered content.

View file

@ -1,37 +1,50 @@
This rule is intended to ensure documents have a title and is triggered when
the first line in the file isn't a top-level (h1) heading:
the first line in a document is not a top-level ([HTML][HTML] `h1`) heading:
```markdown
This is a file without a heading
This is a document without a heading
```
To fix this, add a top-level heading to the beginning of the file:
To fix this, add a top-level heading to the beginning of the document:
```markdown
# File with heading
# Document Heading
This is a file with a top-level heading
This is a document with a top-level heading
```
Because it is common for projects on GitHub to use an image for the heading of
`README.md` and that is not well-supported by Markdown, HTML headings are also
permitted by this rule. For example:
`README.md` and that pattern is not well-supported by Markdown, HTML headings
are also permitted by this rule. For example:
```markdown
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
This is a file with a top-level HTML heading
This is a document with a top-level HTML heading
```
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
cases where an h1 is added externally.
In some cases, a document's title heading may be preceded by text like a table
of contents. This is not ideal for accessibility, but can be allowed by setting
the `allow_preamble` parameter to `true`.
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
contains a `title` property (commonly used with blog posts), this rule will not
report a violation. To use a different property name in the front matter,
specify the text of a regular expression via the `front_matter_title` parameter.
To disable the use of front matter by this rule, specify `""` for
`front_matter_title`.
```markdown
This is a document with preamble text
# Document Heading
```
If [YAML][YAML] front matter is present and contains a `title` property
(commonly used with blog posts), this rule will not report a violation. To use a
different property name in the front matter, specify the text of a [regular
expression][RegExp] via the `front_matter_title` parameter. To disable the use
of front matter by this rule, specify `""` for `front_matter_title`.
The `level` parameter can be used to change the top-level heading (ex: to `h2`)
in cases where an `h1` is added externally.
Rationale: The top-level heading often acts as the title of a document. More
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
[HTML]: https://en.wikipedia.org/wiki/HTML
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
[YAML]: https://en.wikipedia.org/wiki/YAML

View file

@ -5,7 +5,7 @@ structure for a set of files.
To require exactly the following structure:
```markdown
# Head
# Heading
## Item
### Detail
```
@ -14,7 +14,7 @@ Set the `headings` parameter to:
```json
[
"# Head",
"# Heading",
"## Item",
"### Detail"
]
@ -23,7 +23,7 @@ Set the `headings` parameter to:
To allow optional headings as with the following structure:
```markdown
# Head
# Heading
## Item
### Detail (optional)
## Foot
@ -36,7 +36,7 @@ special value `"+"` meaning "one or more unspecified headings" and set the
```json
[
"# Head",
"# Heading",
"## Item",
"*",
"## Foot",
@ -44,6 +44,24 @@ special value `"+"` meaning "one or more unspecified headings" and set the
]
```
To allow a single required heading to vary as with a project name:
```markdown
# Project Name
## Description
## Examples
```
Use the special value `"?"` meaning "exactly one unspecified heading":
```json
[
"?",
"## Description",
"## Examples"
]
```
When an error is detected, this rule outputs the line number of the first
problematic heading (otherwise, it outputs the last line number of the file).

View file

@ -1,4 +1,4 @@
This rule is triggered when an image is missing alternate text (alt text)
This rule reports a violation when an image is missing alternate text (alt text)
information.
Alternate text is commonly specified inline as:
@ -23,12 +23,20 @@ Or with HTML as:
<img src="image.jpg" alt="Alternate text" />
```
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
image from assistive technology, this rule does not report a violation:
```html
<img src="image.jpg" aria-hidden="true" />
```
Guidance for writing alternate text is available from the [W3C][w3c],
[Wikipedia][wikipedia], and [other locations][phase2technology].
Rationale: Alternate text is important for accessibility and describes the
content of an image for people who may not be able to see it.
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
[w3c]: https://www.w3.org/WAI/alt/
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute

View file

@ -52,6 +52,13 @@ attribute can be used to define a fragment:
An `a` tag can be useful in scenarios where a heading is not appropriate or for
control over the text of the fragment identifier.
[HTML links to `#top` scroll to the top of a document][html-top-fragment]. This
rule allows that syntax (using lower-case for consistency):
```markdown
[Link](#top)
```
This rule also recognizes the custom fragment syntax used by GitHub to highlight
[specific content in a document][github-linking-to-content].
@ -67,6 +74,12 @@ And this link to content starting within line 19 running into line 21:
[Link](#L19C5-L21C11)
```
Some Markdown generators dynamically create and insert headings when building
documents, for example by combining a fixed prefix like `figure-` and an
incrementing numeric counter. To ignore such generated fragments, set the
`ignored_pattern` [regular expression][RegEx] parameter to a pattern that
matches (e.g., `^figure-`).
Rationale: [GitHub section links][github-section-links] are created
automatically for every heading when Markdown content is displayed on GitHub.
This makes it easy to link directly to different sections within a document.
@ -81,3 +94,5 @@ append an incrementing integer as needed for uniqueness.
[github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
[github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown#linking-to-markdown
[html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
[RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions

View file

@ -28,3 +28,14 @@ so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
the `include_shortcut` parameter to `true`. Note that doing so produces warnings
for *all* text in the document that *could* be a shortcut. If bracketed text is
intentional, brackets can be escaped with the `\` character: `\[example\]`.
If there are link labels that are deliberately unreferenced, they can be ignored
by setting the `ignored_labels` parameter to the list of strings to ignore. The
default value of this parameter ignores the checkbox syntax used by
[GitHub Flavored Markdown task list items][gfm-tasklist]:
```markdown
- [x] Checked task list item
```
[gfm-tasklist]: https://github.github.com/gfm/#task-list-items-extension-

View file

@ -17,9 +17,9 @@ reference has the corresponding label. The "full", "collapsed", and "shortcut"
formats are all supported.
If there are reference definitions that are deliberately unreferenced, they can
be ignored by setting the `ignored_definitions` parameter. The default value of
this parameter ignores the following convention for adding non-HTML comments to
Markdown:
be ignored by setting the `ignored_definitions` parameter to the list of strings
to ignore. The default value of this parameter ignores the following convention
for adding non-HTML comments to Markdown:
```markdown
[//]: # (This behaves like a comment)

19
doc-build/md059.md Normal file
View file

@ -0,0 +1,19 @@
This rule is triggered when a link has generic text like `[click here](...)` or
`[link](...)`.
Link text should be descriptive and communicate the purpose of the link (e.g.,
`[Download the budget document](...)` or `[CommonMark Specification](...)`).
This is especially important for screen readers which sometimes present links
without context.
By default, this rule prohibits a small number of common English words/phrases.
To customize that list of words/phrases, set the `prohibited_texts` parameter to
an `Array` of `string`s.
Note: For languages other than English, use the `prohibited_texts` parameter to
customize the list for that language. It is *not* a goal for this rule to have
translations for every language.
Note: This rule checks Markdown links; HTML links are ignored.
More information: <https://webaim.org/techniques/hypertext/>

View file

@ -36,7 +36,7 @@ A simple rule implementation using the `micromark` parser to report a violation
for any use of blockquotes might look like:
```javascript
/** @type import("markdownlint").Rule */
/** @type {import("markdownlint").Rule} */
module.exports = {
"names": [ "any-blockquote-micromark" ],
"description": "Rule that reports an error for any blockquote",
@ -61,7 +61,7 @@ module.exports = {
That same rule implemented using the `markdown-it` parser might look like:
```javascript
/** @type import("markdownlint").Rule */
/** @type {import("markdownlint").Rule} */
module.exports = {
"names": [ "any-blockquote-markdown-it" ],
"description": "Rule that reports an error for any blockquote",
@ -160,8 +160,8 @@ implementation that is resolved when the rule completes. (The value passed to
reported via the `onError` function just like for synchronous rules.
**Note**: Asynchronous rules cannot be referenced in a synchronous calling
context (i.e., `markdownlint.sync(...)`). Attempting to do so throws an
exception.
context (i.e., `import { lint } from "markdownlint/sync"`). Attempting to do so
throws an exception.
## Examples
@ -187,8 +187,8 @@ exception.
[markdown-it-token]: https://markdown-it.github.io/markdown-it/#Token
[markdownlint-rule]: https://www.npmjs.com/search?q=keywords:markdownlint-rule
[micromark]: https://github.com/micromark/micromark
[micromark-token]: ../lib/markdownlint.d.ts
[micromark-token]: ../lib/markdownlint.d.mts
[rule-helpers]: https://www.npmjs.com/package/markdownlint-rule-helpers
[options-custom-rules]: ../README.md#optionscustomrules
[test-rules]: ../test/rules
[tokens]: ../test/snapshots/markdownlint-test-custom-rules.js.md
[tokens]: ../test/snapshots/markdownlint-test-custom-rules.mjs.md

View file

@ -943,6 +943,10 @@ Tags: `blockquote`, `indentation`, `whitespace`
Aliases: `no-multiple-space-blockquote`
Parameters:
- `list_items`: Include list items (`boolean`, default `true`)
Fixable: Some violations can be fixed by tooling
This rule is triggered when blockquotes have more than one space after the
@ -960,6 +964,10 @@ To fix, remove any extraneous space:
> indentation.
```
Inferring intended list indentation within a blockquote can be challenging;
setting the `list_items` parameter to `false` disables this rule for ordered
and unordered list items.
Rationale: Consistent formatting makes it easier to understand a document.
<a name="md028"></a>
@ -1528,38 +1536,50 @@ Aliases: `no-space-in-code`
Fixable: Some violations can be fixed by tooling
This rule is triggered for code span elements that have spaces adjacent to the
backticks:
This rule is triggered for code spans containing content with unnecessary space
next to the beginning or ending backticks:
```markdown
`some text `
` some text`
` some text `
```
To fix this, remove any spaces adjacent to the backticks:
To fix this, remove the extra space characters from the beginning and ending:
```markdown
`some text`
```
Note: A single leading and trailing space is allowed by the specification and
automatically trimmed (in order to allow for code spans that embed backticks):
Note: A single leading *and* trailing space is allowed by the specification and
trimmed by the parser to support code spans that begin or end with a backtick:
```markdown
`` `backticks` ``
`` backtick` ``
```
Note: A single leading or trailing space is allowed if used to separate code
span markers from an embedded backtick (though the space is not trimmed):
Note: When single-space padding is present in the input, it will be preserved
(even if unnecessary):
```markdown
`` ` embedded backtick``
` code `
```
Rationale: Violations of this rule are usually unintentional and may lead to
improperly-rendered content. If spaces beside backticks are intentional, this
rule can be disabled for that line or file.
Note: Code spans containing only spaces are allowed by the specification and are
also preserved:
```markdown
` `
` `
```
Rationale: Violations of this rule are usually unintentional and can lead to
improperly-rendered content.
<a name="md039"></a>
@ -1650,48 +1670,63 @@ Aliases: `first-line-h1`, `first-line-heading`
Parameters:
- `allow_preamble`: Allow content before first heading (`boolean`, default
`false`)
- `front_matter_title`: RegExp for matching title in front matter (`string`,
default `^\s*title\s*[:=]`)
- `level`: Heading level (`integer`, default `1`)
This rule is intended to ensure documents have a title and is triggered when
the first line in the file isn't a top-level (h1) heading:
the first line in a document is not a top-level ([HTML][HTML] `h1`) heading:
```markdown
This is a file without a heading
This is a document without a heading
```
To fix this, add a top-level heading to the beginning of the file:
To fix this, add a top-level heading to the beginning of the document:
```markdown
# File with heading
# Document Heading
This is a file with a top-level heading
This is a document with a top-level heading
```
Because it is common for projects on GitHub to use an image for the heading of
`README.md` and that is not well-supported by Markdown, HTML headings are also
permitted by this rule. For example:
`README.md` and that pattern is not well-supported by Markdown, HTML headings
are also permitted by this rule. For example:
```markdown
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
This is a file with a top-level HTML heading
This is a document with a top-level HTML heading
```
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
cases where an h1 is added externally.
In some cases, a document's title heading may be preceded by text like a table
of contents. This is not ideal for accessibility, but can be allowed by setting
the `allow_preamble` parameter to `true`.
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
contains a `title` property (commonly used with blog posts), this rule will not
report a violation. To use a different property name in the front matter,
specify the text of a regular expression via the `front_matter_title` parameter.
To disable the use of front matter by this rule, specify `""` for
`front_matter_title`.
```markdown
This is a document with preamble text
# Document Heading
```
If [YAML][YAML] front matter is present and contains a `title` property
(commonly used with blog posts), this rule will not report a violation. To use a
different property name in the front matter, specify the text of a [regular
expression][RegExp] via the `front_matter_title` parameter. To disable the use
of front matter by this rule, specify `""` for `front_matter_title`.
The `level` parameter can be used to change the top-level heading (ex: to `h2`)
in cases where an `h1` is added externally.
Rationale: The top-level heading often acts as the title of a document. More
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
[HTML]: https://en.wikipedia.org/wiki/HTML
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
[YAML]: https://en.wikipedia.org/wiki/YAML
<a name="md042"></a>
## `MD042` - No empty links
@ -1747,7 +1782,7 @@ structure for a set of files.
To require exactly the following structure:
```markdown
# Head
# Heading
## Item
### Detail
```
@ -1756,7 +1791,7 @@ Set the `headings` parameter to:
```json
[
"# Head",
"# Heading",
"## Item",
"### Detail"
]
@ -1765,7 +1800,7 @@ Set the `headings` parameter to:
To allow optional headings as with the following structure:
```markdown
# Head
# Heading
## Item
### Detail (optional)
## Foot
@ -1778,7 +1813,7 @@ special value `"+"` meaning "one or more unspecified headings" and set the
```json
[
"# Head",
"# Heading",
"## Item",
"*",
"## Foot",
@ -1786,6 +1821,24 @@ special value `"+"` meaning "one or more unspecified headings" and set the
]
```
To allow a single required heading to vary as with a project name:
```markdown
# Project Name
## Description
## Examples
```
Use the special value `"?"` meaning "exactly one unspecified heading":
```json
[
"?",
"## Description",
"## Examples"
]
```
When an error is detected, this rule outputs the line number of the first
problematic heading (otherwise, it outputs the last line number of the file).
@ -1855,7 +1908,7 @@ Tags: `accessibility`, `images`
Aliases: `no-alt-text`
This rule is triggered when an image is missing alternate text (alt text)
This rule reports a violation when an image is missing alternate text (alt text)
information.
Alternate text is commonly specified inline as:
@ -1880,12 +1933,20 @@ Or with HTML as:
<img src="image.jpg" alt="Alternate text" />
```
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
image from assistive technology, this rule does not report a violation:
```html
<img src="image.jpg" aria-hidden="true" />
```
Guidance for writing alternate text is available from the [W3C][w3c],
[Wikipedia][wikipedia], and [other locations][phase2technology].
Rationale: Alternate text is important for accessibility and describes the
content of an image for people who may not be able to see it.
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
[w3c]: https://www.w3.org/WAI/alt/
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute
@ -2103,6 +2164,8 @@ Aliases: `link-fragments`
Parameters:
- `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
- `ignored_pattern`: Pattern for ignoring additional fragments (`string`,
default ``)
Fixable: Some violations can be fixed by tooling
@ -2160,6 +2223,13 @@ attribute can be used to define a fragment:
An `a` tag can be useful in scenarios where a heading is not appropriate or for
control over the text of the fragment identifier.
[HTML links to `#top` scroll to the top of a document][html-top-fragment]. This
rule allows that syntax (using lower-case for consistency):
```markdown
[Link](#top)
```
This rule also recognizes the custom fragment syntax used by GitHub to highlight
[specific content in a document][github-linking-to-content].
@ -2175,6 +2245,12 @@ And this link to content starting within line 19 running into line 21:
[Link](#L19C5-L21C11)
```
Some Markdown generators dynamically create and insert headings when building
documents, for example by combining a fixed prefix like `figure-` and an
incrementing numeric counter. To ignore such generated fragments, set the
`ignored_pattern` [regular expression][RegEx] parameter to a pattern that
matches (e.g., `^figure-`).
Rationale: [GitHub section links][github-section-links] are created
automatically for every heading when Markdown content is displayed on GitHub.
This makes it easy to link directly to different sections within a document.
@ -2189,6 +2265,8 @@ append an incrementing integer as needed for uniqueness.
[github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
[github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown#linking-to-markdown
[html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
[RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
<a name="md052"></a>
@ -2200,6 +2278,7 @@ Aliases: `reference-links-images`
Parameters:
- `ignored_labels`: Ignored link labels (`string[]`, default `["x"]`)
- `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
Links and images in Markdown can provide the link destination or image source
@ -2233,6 +2312,17 @@ the `include_shortcut` parameter to `true`. Note that doing so produces warnings
for *all* text in the document that *could* be a shortcut. If bracketed text is
intentional, brackets can be escaped with the `\` character: `\[example\]`.
If there are link labels that are deliberately unreferenced, they can be ignored
by setting the `ignored_labels` parameter to the list of strings to ignore. The
default value of this parameter ignores the checkbox syntax used by
[GitHub Flavored Markdown task list items][gfm-tasklist]:
```markdown
- [x] Checked task list item
```
[gfm-tasklist]: https://github.github.com/gfm/#task-list-items-extension-
<a name="md053"></a>
## `MD053` - Link and image reference definitions should be needed
@ -2266,9 +2356,9 @@ reference has the corresponding label. The "full", "collapsed", and "shortcut"
formats are all supported.
If there are reference definitions that are deliberately unreferenced, they can
be ignored by setting the `ignored_definitions` parameter. The default value of
this parameter ignores the following convention for adding non-HTML comments to
Markdown:
be ignored by setting the `ignored_definitions` parameter to the list of strings
to ignore. The default value of this parameter ignores the following convention
for adding non-HTML comments to Markdown:
```markdown
[//]: # (This behaves like a comment)
@ -2526,6 +2616,39 @@ Some text
Rationale: In addition to aesthetic reasons, some parsers will incorrectly parse
tables that don't have blank lines before and after them.
<a name="md059"></a>
## `MD059` - Link text should be descriptive
Tags: `accessibility`, `links`
Aliases: `descriptive-link-text`
Parameters:
- `prohibited_texts`: Prohibited link texts (`string[]`, default `["click
here","here","link","more"]`)
This rule is triggered when a link has generic text like `[click here](...)` or
`[link](...)`.
Link text should be descriptive and communicate the purpose of the link (e.g.,
`[Download the budget document](...)` or `[CommonMark Specification](...)`).
This is especially important for screen readers which sometimes present links
without context.
By default, this rule prohibits a small number of common English words/phrases.
To customize that list of words/phrases, set the `prohibited_texts` parameter to
an `Array` of `string`s.
Note: For languages other than English, use the `prohibited_texts` parameter to
customize the list for that language. It is *not* a goal for this rule to have
translations for every language.
Note: This rule checks Markdown links; HTML links are ignored.
More information: <https://webaim.org/techniques/hypertext/>
<!-- markdownlint-configure-file {
"no-inline-html": {
"allowed_elements": [

View file

@ -4,6 +4,10 @@ Tags: `blockquote`, `indentation`, `whitespace`
Aliases: `no-multiple-space-blockquote`
Parameters:
- `list_items`: Include list items (`boolean`, default `true`)
Fixable: Some violations can be fixed by tooling
This rule is triggered when blockquotes have more than one space after the
@ -21,4 +25,8 @@ To fix, remove any extraneous space:
> indentation.
```
Inferring intended list indentation within a blockquote can be challenging;
setting the `list_items` parameter to `false` disables this rule for ordered
and unordered list items.
Rationale: Consistent formatting makes it easier to understand a document.

View file

@ -6,35 +6,47 @@ Aliases: `no-space-in-code`
Fixable: Some violations can be fixed by tooling
This rule is triggered for code span elements that have spaces adjacent to the
backticks:
This rule is triggered for code spans containing content with unnecessary space
next to the beginning or ending backticks:
```markdown
`some text `
` some text`
` some text `
```
To fix this, remove any spaces adjacent to the backticks:
To fix this, remove the extra space characters from the beginning and ending:
```markdown
`some text`
```
Note: A single leading and trailing space is allowed by the specification and
automatically trimmed (in order to allow for code spans that embed backticks):
Note: A single leading *and* trailing space is allowed by the specification and
trimmed by the parser to support code spans that begin or end with a backtick:
```markdown
`` `backticks` ``
`` backtick` ``
```
Note: A single leading or trailing space is allowed if used to separate code
span markers from an embedded backtick (though the space is not trimmed):
Note: When single-space padding is present in the input, it will be preserved
(even if unnecessary):
```markdown
`` ` embedded backtick``
` code `
```
Rationale: Violations of this rule are usually unintentional and may lead to
improperly-rendered content. If spaces beside backticks are intentional, this
rule can be disabled for that line or file.
Note: Code spans containing only spaces are allowed by the specification and are
also preserved:
```markdown
` `
` `
```
Rationale: Violations of this rule are usually unintentional and can lead to
improperly-rendered content.

View file

@ -6,44 +6,59 @@ Aliases: `first-line-h1`, `first-line-heading`
Parameters:
- `allow_preamble`: Allow content before first heading (`boolean`, default
`false`)
- `front_matter_title`: RegExp for matching title in front matter (`string`,
default `^\s*title\s*[:=]`)
- `level`: Heading level (`integer`, default `1`)
This rule is intended to ensure documents have a title and is triggered when
the first line in the file isn't a top-level (h1) heading:
the first line in a document is not a top-level ([HTML][HTML] `h1`) heading:
```markdown
This is a file without a heading
This is a document without a heading
```
To fix this, add a top-level heading to the beginning of the file:
To fix this, add a top-level heading to the beginning of the document:
```markdown
# File with heading
# Document Heading
This is a file with a top-level heading
This is a document with a top-level heading
```
Because it is common for projects on GitHub to use an image for the heading of
`README.md` and that is not well-supported by Markdown, HTML headings are also
permitted by this rule. For example:
`README.md` and that pattern is not well-supported by Markdown, HTML headings
are also permitted by this rule. For example:
```markdown
<h1 align="center"><img src="https://placekitten.com/300/150"/></h1>
This is a file with a top-level HTML heading
This is a document with a top-level HTML heading
```
Note: The `level` parameter can be used to change the top-level (ex: to h2) in
cases where an h1 is added externally.
In some cases, a document's title heading may be preceded by text like a table
of contents. This is not ideal for accessibility, but can be allowed by setting
the `allow_preamble` parameter to `true`.
If [YAML](https://en.wikipedia.org/wiki/YAML) front matter is present and
contains a `title` property (commonly used with blog posts), this rule will not
report a violation. To use a different property name in the front matter,
specify the text of a regular expression via the `front_matter_title` parameter.
To disable the use of front matter by this rule, specify `""` for
`front_matter_title`.
```markdown
This is a document with preamble text
# Document Heading
```
If [YAML][YAML] front matter is present and contains a `title` property
(commonly used with blog posts), this rule will not report a violation. To use a
different property name in the front matter, specify the text of a [regular
expression][RegExp] via the `front_matter_title` parameter. To disable the use
of front matter by this rule, specify `""` for `front_matter_title`.
The `level` parameter can be used to change the top-level heading (ex: to `h2`)
in cases where an `h1` is added externally.
Rationale: The top-level heading often acts as the title of a document. More
information: <https://cirosantilli.com/markdown-style-guide#top-level-header>.
[HTML]: https://en.wikipedia.org/wiki/HTML
[RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions
[YAML]: https://en.wikipedia.org/wiki/YAML

View file

@ -16,7 +16,7 @@ structure for a set of files.
To require exactly the following structure:
```markdown
# Head
# Heading
## Item
### Detail
```
@ -25,7 +25,7 @@ Set the `headings` parameter to:
```json
[
"# Head",
"# Heading",
"## Item",
"### Detail"
]
@ -34,7 +34,7 @@ Set the `headings` parameter to:
To allow optional headings as with the following structure:
```markdown
# Head
# Heading
## Item
### Detail (optional)
## Foot
@ -47,7 +47,7 @@ special value `"+"` meaning "one or more unspecified headings" and set the
```json
[
"# Head",
"# Heading",
"## Item",
"*",
"## Foot",
@ -55,6 +55,24 @@ special value `"+"` meaning "one or more unspecified headings" and set the
]
```
To allow a single required heading to vary as with a project name:
```markdown
# Project Name
## Description
## Examples
```
Use the special value `"?"` meaning "exactly one unspecified heading":
```json
[
"?",
"## Description",
"## Examples"
]
```
When an error is detected, this rule outputs the line number of the first
problematic heading (otherwise, it outputs the last line number of the file).

View file

@ -4,7 +4,7 @@ Tags: `accessibility`, `images`
Aliases: `no-alt-text`
This rule is triggered when an image is missing alternate text (alt text)
This rule reports a violation when an image is missing alternate text (alt text)
information.
Alternate text is commonly specified inline as:
@ -29,12 +29,20 @@ Or with HTML as:
<img src="image.jpg" alt="Alternate text" />
```
Note: If the [HTML `aria-hidden` attribute][aria-hidden] is used to hide the
image from assistive technology, this rule does not report a violation:
```html
<img src="image.jpg" aria-hidden="true" />
```
Guidance for writing alternate text is available from the [W3C][w3c],
[Wikipedia][wikipedia], and [other locations][phase2technology].
Rationale: Alternate text is important for accessibility and describes the
content of an image for people who may not be able to see it.
[aria-hidden]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-hidden
[phase2technology]: https://www.phase2technology.com/blog/no-more-excuses
[w3c]: https://www.w3.org/WAI/alt/
[wikipedia]: https://en.wikipedia.org/wiki/Alt_attribute

View file

@ -7,6 +7,8 @@ Aliases: `link-fragments`
Parameters:
- `ignore_case`: Ignore case of fragments (`boolean`, default `false`)
- `ignored_pattern`: Pattern for ignoring additional fragments (`string`,
default ``)
Fixable: Some violations can be fixed by tooling
@ -64,6 +66,13 @@ attribute can be used to define a fragment:
An `a` tag can be useful in scenarios where a heading is not appropriate or for
control over the text of the fragment identifier.
[HTML links to `#top` scroll to the top of a document][html-top-fragment]. This
rule allows that syntax (using lower-case for consistency):
```markdown
[Link](#top)
```
This rule also recognizes the custom fragment syntax used by GitHub to highlight
[specific content in a document][github-linking-to-content].
@ -79,6 +88,12 @@ And this link to content starting within line 19 running into line 21:
[Link](#L19C5-L21C11)
```
Some Markdown generators dynamically create and insert headings when building
documents, for example by combining a fixed prefix like `figure-` and an
incrementing numeric counter. To ignore such generated fragments, set the
`ignored_pattern` [regular expression][RegEx] parameter to a pattern that
matches (e.g., `^figure-`).
Rationale: [GitHub section links][github-section-links] are created
automatically for every heading when Markdown content is displayed on GitHub.
This makes it easy to link directly to different sections within a document.
@ -93,3 +108,5 @@ append an incrementing integer as needed for uniqueness.
[github-section-links]: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#section-links
[github-heading-algorithm]: https://github.com/gjtorikian/html-pipeline/blob/f13a1534cb650ba17af400d1acd3a22c28004c09/lib/html/pipeline/toc_filter.rb
[github-linking-to-content]: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-a-permanent-link-to-a-code-snippet#linking-to-markdown#linking-to-markdown
[html-top-fragment]: https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment
[RegEx]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions

View file

@ -6,6 +6,7 @@ Aliases: `reference-links-images`
Parameters:
- `ignored_labels`: Ignored link labels (`string[]`, default `["x"]`)
- `shortcut_syntax`: Include shortcut syntax (`boolean`, default `false`)
Links and images in Markdown can provide the link destination or image source
@ -38,3 +39,14 @@ so "shortcut" syntax is ignored by default. To include "shortcut" syntax, set
the `include_shortcut` parameter to `true`. Note that doing so produces warnings
for *all* text in the document that *could* be a shortcut. If bracketed text is
intentional, brackets can be escaped with the `\` character: `\[example\]`.
If there are link labels that are deliberately unreferenced, they can be ignored
by setting the `ignored_labels` parameter to the list of strings to ignore. The
default value of this parameter ignores the checkbox syntax used by
[GitHub Flavored Markdown task list items][gfm-tasklist]:
```markdown
- [x] Checked task list item
```
[gfm-tasklist]: https://github.github.com/gfm/#task-list-items-extension-

View file

@ -29,9 +29,9 @@ reference has the corresponding label. The "full", "collapsed", and "shortcut"
formats are all supported.
If there are reference definitions that are deliberately unreferenced, they can
be ignored by setting the `ignored_definitions` parameter. The default value of
this parameter ignores the following convention for adding non-HTML comments to
Markdown:
be ignored by setting the `ignored_definitions` parameter to the list of strings
to ignore. The default value of this parameter ignores the following convention
for adding non-HTML comments to Markdown:
```markdown
[//]: # (This behaves like a comment)

30
doc/md059.md Normal file
View file

@ -0,0 +1,30 @@
# `MD059` - Link text should be descriptive
Tags: `accessibility`, `links`
Aliases: `descriptive-link-text`
Parameters:
- `prohibited_texts`: Prohibited link texts (`string[]`, default `["click
here","here","link","more"]`)
This rule is triggered when a link has generic text like `[click here](...)` or
`[link](...)`.
Link text should be descriptive and communicate the purpose of the link (e.g.,
`[Download the budget document](...)` or `[CommonMark Specification](...)`).
This is especially important for screen readers which sometimes present links
without context.
By default, this rule prohibits a small number of common English words/phrases.
To customize that list of words/phrases, set the `prohibited_texts` parameter to
an `Array` of `string`s.
Note: For languages other than English, use the `prohibited_texts` parameter to
customize the list for that language. It is *not* a goal for this rule to have
translations for every language.
Note: This rule checks Markdown links; HTML links are ignored.
More information: <https://webaim.org/techniques/hypertext/>

View file

@ -25,20 +25,11 @@ export default [
"demo/markdown-it.min.js",
"demo/markdownlint-browser.js",
"demo/markdownlint-browser.min.js",
"demo/micromark-browser.js",
"demo/micromark-html-browser.js",
"example/typescript/type-check.js",
"micromark/micromark.cjs",
"micromark/micromark.dev.cjs",
"micromark/micromark-browser.js",
"micromark/micromark-browser.dev.js",
"example/typescript/type-check-*",
"test-repos/**"
]
},
{
"languageOptions": {
"sourceType": "commonjs"
},
"linterOptions": {
"reportUnusedDisableDirectives": true
},
@ -88,7 +79,6 @@ export default [
"unicorn/no-null": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/prefer-at": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-string-raw": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-string-slice": "off",
@ -107,15 +97,20 @@ export default [
},
{
"files": [
"**/*.mjs"
"**/*.js",
"**/*.cjs"
],
"languageOptions": {
"sourceType": "module"
"sourceType": "commonjs",
"globals": {
"module": "readonly",
"require": "readonly"
}
}
},
{
"files": [
"demo/*.js"
"demo/default.js"
],
"languageOptions": {
"globals": {
@ -131,26 +126,42 @@ export default [
"no-invalid-this": "off",
"no-shadow": "off",
"no-var": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-query-selector": "off"
}
},
{
"files": [
"example/*.js"
"example/*.cjs"
],
"languageOptions": {
"sourceType": "commonjs"
},
"rules": {
"n/no-missing-require": "off",
"no-console": "off",
"no-invalid-this": "off",
"no-shadow": "off"
"no-invalid-this": "off"
}
},
{
"files": [
"test/rules/**/*.js"
"example/standalone.mjs"
],
"rules": {
"jsdoc/valid-types": "off"
"no-console": "off",
"no-constant-condition": "off"
}
},
{
"files": [
"test/rules/**/*.js",
"test/rules/**/*.cjs"
],
"languageOptions": {
"sourceType": "commonjs"
},
"rules": {
"unicorn/prefer-module": "off"
}
}
];

28
example/Gruntfile.cjs Normal file
View file

@ -0,0 +1,28 @@
// @ts-check
"use strict";
module.exports = function wrapper(grunt) {
grunt.initConfig({
"markdownlint": {
"example": {
"src": [ "*.md" ]
}
}
});
grunt.registerMultiTask("markdownlint", function task() {
const done = this.async();
import("markdownlint/async").then(({ lint }) => {
lint(
{ "files": this.filesSrc },
function callback(err, result) {
const resultString = err || ((result || "").toString());
if (resultString) {
grunt.fail.warn("\n" + resultString + "\n");
}
done(!err || !resultString);
});
}).catch(done);
});
};

View file

@ -1,28 +0,0 @@
// @ts-check
"use strict";
const markdownlint = require("../lib/markdownlint");
module.exports = function wrapper(grunt) {
grunt.initConfig({
"markdownlint": {
"example": {
"src": [ "*.md" ]
}
}
});
grunt.registerMultiTask("markdownlint", function task() {
const done = this.async();
markdownlint(
{ "files": this.filesSrc },
function callback(err, result) {
const resultString = err || ((result || "").toString());
if (resultString) {
grunt.fail.warn("\n" + resultString + "\n");
}
done(!err || !resultString);
});
});
};

24
example/gulpfile.cjs Normal file
View file

@ -0,0 +1,24 @@
// @ts-check
"use strict";
const gulp = require("gulp");
const through2 = require("through2");
// Simple task wrapper
gulp.task("markdownlint", function task() {
return gulp.src("*.md", { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
import("markdownlint/async").then(({ lint }) => {
lint(
{ "files": [ file.relative ] },
function callback(err, result) {
const resultString = (result || "").toString();
if (resultString) {
console.log(resultString);
}
next(err, file);
});
}).catch(next);
}));
});

View file

@ -1,23 +0,0 @@
// @ts-check
"use strict";
const gulp = require("gulp");
const through2 = require("through2");
const markdownlint = require("../lib/markdownlint");
// Simple task wrapper
gulp.task("markdownlint", function task() {
return gulp.src("*.md", { "read": false })
.pipe(through2.obj(function obj(file, enc, next) {
markdownlint(
{ "files": [ file.relative ] },
function callback(err, result) {
const resultString = (result || "").toString();
if (resultString) {
console.log(resultString);
}
next(err, file);
});
}));
});

View file

@ -1,31 +0,0 @@
// @ts-check
"use strict";
const markdownlint = require("../lib/markdownlint");
const options = {
"files": [ "good.md", "bad.md" ],
"strings": {
"good.string": "# good.string\n\nThis string passes all rules.\n",
"bad.string": "#bad.string\n\n#This string fails\tsome rules.\n"
}
};
// Makes a synchronous call, using result.toString for pretty formatting
const result = markdownlint.sync(options);
console.log(result.toString());
// Makes an asynchronous call
markdownlint(options, function callback(err, result) {
if (!err) {
console.log(result.toString());
}
});
// Displays the result object directly
markdownlint(options, function callback(err, result) {
if (!err) {
console.dir(result, { "colors": true, "depth": null });
}
});

54
example/standalone.mjs Normal file
View file

@ -0,0 +1,54 @@
// @ts-check
import { applyFixes, getVersion } from "markdownlint";
import { lint as lintAsync } from "markdownlint/async";
import { lint as lintPromise } from "markdownlint/promise";
import { lint as lintSync } from "markdownlint/sync";
// Displays the library version
console.log(getVersion());
const options = {
"files": [ "good.md", "bad.md" ],
"strings": {
"good.string": "# good.string\n\nThis string passes all rules.\n",
"bad.string": "#bad.string\n\n#This string fails\tsome rules.\n"
}
};
if (true) {
// Makes a synchronous call, uses result.toString for pretty formatting
const results = lintSync(options);
console.log(results.toString());
}
if (true) {
// Makes an asynchronous call, uses result.toString for pretty formatting
lintAsync(options, function callback(error, results) {
if (!error && results) {
console.log(results.toString());
}
});
}
if (true) {
// Makes a Promise-based asynchronous call, displays the result object directly
const results = await lintPromise(options);
console.dir(results, { "colors": true, "depth": null });
}
if (true) {
// Fixes all supported violations in Markdown content
const original = "# Heading";
const results = lintSync({ "strings": { "content": original } });
const fixed = applyFixes(original, results.content);
console.log(fixed);
}

View file

@ -1 +1 @@
type-check.js
type-check-*

View file

@ -1,25 +1,30 @@
// Attempt to validate all the type declarations in markdownlint.d.ts
// Attempt to validate important type declarations
import markdownlint from "../..";
import { Configuration, ConfigurationStrict, LintResults, Options, Rule, RuleParams, RuleOnError, RuleOnErrorInfo } from "../../lib/exports.mjs";
import { applyFix, applyFixes, getVersion } from "../../lib/exports.mjs";
import { lint as lintAsync, readConfig as readConfigAsync } from "../../lib/exports-async.mjs";
import { lint as lintPromise, readConfig as readConfigPromise } from "../../lib/exports-promise.mjs";
import { lint as lintSync, readConfig as readConfigSync } from "../../lib/exports-sync.mjs";
const assert = require("assert");
import assert from "assert";
import markdownIt from "markdown-it";
const markdownlintJsonPath = "../../.markdownlint.json";
const version: string = markdownlint.getVersion();
const version: string = getVersion();
assert(/^\d+\.\d+\.\d+$/.test(version));
function assertConfiguration(config: markdownlint.Configuration) {
function assertConfiguration(config: Configuration) {
assert(!!config);
assert.deepEqual(config["line-length"], { "strict": true, "code_blocks": false });
// config assignment is covered by markdownlint.Options
}
function assertConfigurationCallback(err: Error | null, config?: markdownlint.Configuration) {
function assertConfigurationCallback(err: Error | null, config?: Configuration) {
assert(!err);
config && assertConfiguration(config);
}
function assertLintResults(results: markdownlint.LintResults) {
function assertLintResults(results: LintResults) {
assert(!!results);
assert.equal(results["string"].length, 1);
assert.equal(results["string"][0].lineNumber, 1);
@ -60,23 +65,23 @@ function assertLintResults(results: markdownlint.LintResults) {
};
}
function assertLintResultsCallback(err: Error | null, results?: markdownlint.LintResults) {
function assertLintResultsCallback(err: Error | null, results?: LintResults) {
assert(!err);
results && assertLintResults(results);
}
assertConfiguration(markdownlint.readConfigSync(markdownlintJsonPath));
assertConfiguration(markdownlint.readConfigSync(markdownlintJsonPath, [ JSON.parse ]));
assertConfiguration(readConfigSync(markdownlintJsonPath));
assertConfiguration(readConfigSync(markdownlintJsonPath, [ JSON.parse ]));
markdownlint.readConfig(markdownlintJsonPath, assertConfigurationCallback);
markdownlint.readConfig(markdownlintJsonPath, [ JSON.parse ], assertConfigurationCallback);
readConfigAsync(markdownlintJsonPath, assertConfigurationCallback);
readConfigAsync(markdownlintJsonPath, [ JSON.parse ], assertConfigurationCallback);
(async () => {
assertConfigurationCallback(null, await markdownlint.promises.readConfig(markdownlintJsonPath));
assertConfigurationCallback(null, await markdownlint.promises.readConfig(markdownlintJsonPath, [ JSON.parse ]))
assertConfigurationCallback(null, await readConfigPromise(markdownlintJsonPath));
assertConfigurationCallback(null, await readConfigPromise(markdownlintJsonPath, [ JSON.parse ]))
})();
let options: markdownlint.Options;
let options: Options;
options = {
"files": [ "../bad.md" ],
"strings": {
@ -93,32 +98,32 @@ options = {
"frontMatter": /---/,
"handleRuleFailures": false,
"noInlineConfig": false,
"markdownItPlugins": [ [ require("markdown-it-sub") ] ]
"markdownItFactory": () => markdownIt()
};
assertLintResults(markdownlint.sync(options));
markdownlint(options, assertLintResultsCallback);
assertLintResults(lintSync(options));
lintAsync(options, assertLintResultsCallback);
(async () => {
assertLintResultsCallback(null, await markdownlint.promises.markdownlint(options));
assertLintResultsCallback(null, await lintPromise(options));
})();
options.files = "../bad.md";
assertLintResults(markdownlint.sync(options));
markdownlint(options, assertLintResultsCallback);
assertLintResults(lintSync(options));
lintAsync(options, assertLintResultsCallback);
(async () => {
assertLintResultsCallback(null, await markdownlint.promises.markdownlint(options));
assertLintResultsCallback(null, await lintPromise(options));
})();
const testRule: markdownlint.Rule = {
const testRule: Rule = {
"names": [ "test-rule" ],
"description": "Test rule",
"information": new URL("https://example.com/rule-information"),
"tags": [ "test-tag" ],
"parser": "none",
"function": function rule(params: markdownlint.RuleParams, onError: markdownlint.RuleOnError) {
"function": function rule(params: RuleParams, onError: RuleOnError) {
assert(!!params);
assert(!!onError);
let ruleParams: markdownlint.RuleParams;
let ruleParams: RuleParams;
ruleParams = {
"name": "name",
"parsers": {
@ -140,7 +145,7 @@ const testRule: markdownlint.Rule = {
"version": "1.2.3"
};
assert(ruleParams);
let ruleOnErrorInfo: markdownlint.RuleOnErrorInfo;
let ruleOnErrorInfo: RuleOnErrorInfo;
ruleOnErrorInfo = {
"lineNumber": 1,
"detail": "detail",
@ -160,14 +165,14 @@ const testRule: markdownlint.Rule = {
};
options.customRules = [ testRule ];
assertLintResults(markdownlint.sync(options));
markdownlint(options, assertLintResultsCallback);
assertLintResults(lintSync(options));
lintAsync(options, assertLintResultsCallback);
(async () => {
assertLintResultsCallback(null, await markdownlint.promises.markdownlint(options));
assertLintResultsCallback(null, await lintPromise(options));
})();
assert.equal(
markdownlint.applyFix(
applyFix(
"# Fixing\n",
{
"insertText": "Head",
@ -180,7 +185,7 @@ assert.equal(
);
assert.equal(
markdownlint.applyFixes(
applyFixes(
"# Fixing\n",
[
{
@ -196,7 +201,7 @@ assert.equal(
"# Heading\n"
);
const configuration: markdownlint.Configuration = {
const configuration: Configuration = {
"custom-rule": true,
"no-hard-tabs": false,
"heading-style": {
@ -204,7 +209,7 @@ const configuration: markdownlint.Configuration = {
}
};
assert(configuration);
const configurationStrict: markdownlint.ConfigurationStrict = {
const configurationStrict: ConfigurationStrict = {
// "custom-rule": true,
"no-hard-tabs": false,
"heading-style": {

View file

@ -1 +1 @@
test.js
test.cjs

View file

@ -22,8 +22,8 @@ be useful to custom rule authors and may avoid duplicating code.
*None* - The entire body of code is tested to 100% coverage by the core
`markdownlint` project, so there are no additional tests here.
[custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/CustomRules.md
[custom-rules]: https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/CustomRules.md
[jsdoc]: https://en.m.wikipedia.org/wiki/JSDoc
[markdown]: https://en.wikipedia.org/wiki/Markdown
[markdownlint]: https://github.com/DavidAnson/markdownlint
[rules]: https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/Rules.md
[rules]: https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/Rules.md

View file

@ -4,15 +4,21 @@
const micromark = require("./micromark-helpers.cjs");
const { newLineRe, nextLinesRe } = require("./shared.js");
const { newLineRe, nextLinesRe } = require("./shared.cjs");
module.exports.newLineRe = newLineRe;
module.exports.nextLinesRe = nextLinesRe;
/** @typedef {import("../lib/markdownlint.js").RuleOnError} RuleOnError */
/** @typedef {import("../lib/markdownlint.js").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
/** @typedef {import("../lib/exports.mjs").RuleOnError} RuleOnError */
/** @typedef {import("../lib/exports.mjs").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
/** @typedef {import("../lib/exports.mjs").MicromarkToken} MicromarkToken */
// eslint-disable-next-line jsdoc/valid-types
/** @typedef {import("micromark-extension-gfm-footnote", { with: { "resolution-mode": "import" } })} */
// eslint-disable-next-line jsdoc/valid-types
/** @typedef {import("../lib/micromark-types.d.mts", { with: { "resolution-mode": "import" } })} */
// Regular expression for matching common front matter (YAML and TOML)
// @ts-ignore
module.exports.frontMatterRe =
/((^---[^\S\r\n\u2028\u2029]*$[\s\S]+?^---\s*)|(^\+\+\+[^\S\r\n\u2028\u2029]*$[\s\S]+?^(\+\+\+|\.\.\.)\s*)|(^\{[^\S\r\n\u2028\u2029]*$[\s\S]+?^\}\s*))(\r\n|\r|\n|$)/m;
@ -304,7 +310,7 @@ module.exports.addErrorDetailIf = addErrorDetailIf;
*/
function addErrorContext(
onError, lineNumber, context, start, end, range, fixInfo) {
context = ellipsify(context, start, end);
context = ellipsify(context.replace(newLineRe, "\n"), start, end);
addError(onError, lineNumber, undefined, context, range, fixInfo);
}
module.exports.addErrorContext = addErrorContext;
@ -336,8 +342,8 @@ const positionLessThanOrEqual = (lineA, columnA, lineB, columnB) => (
/**
* Returns whether two ranges (or MicromarkTokens) overlap anywhere.
*
* @param {FileRange|import("../lib/markdownlint.js").MicromarkToken} rangeA Range A.
* @param {FileRange|import("../lib/markdownlint.js").MicromarkToken} rangeB Range B.
* @param {FileRange|MicromarkToken} rangeA Range A.
* @param {FileRange|MicromarkToken} rangeB Range B.
* @returns {boolean} True iff the two ranges overlap.
*/
module.exports.hasOverlap = function hasOverlap(rangeA, rangeB) {
@ -364,11 +370,12 @@ module.exports.frontMatterHasTitle =
/**
* Returns an object with information about reference links and images.
*
* @param {import("../helpers/micromark-helpers.cjs").Token[]} tokens Micromark tokens.
* @param {MicromarkToken[]} tokens Micromark tokens.
* @returns {Object} Reference link/image data.
*/
function getReferenceLinkImageData(tokens) {
const normalizeReference = (s) => s.toLowerCase().trim().replace(/\s+/g, " ");
const getText = (t) => t?.children.filter((c) => c.type !== "blockQuotePrefix").map((c) => c.text).join("");
const references = new Map();
const shortcuts = new Map();
const addReferenceToDictionary = (token, label, isShortcut) => {
@ -440,7 +447,7 @@ function getReferenceLinkImageData(tokens) {
const isFullOrCollapsed = (token.children.length === 2) && !token.children.some((t) => t.type === "resource");
const [ labelText ] = micromark.getDescendantsByType(token, [ "label", "labelText" ]);
const [ referenceString ] = micromark.getDescendantsByType(token, [ "reference", "referenceString" ]);
let label = labelText?.text;
let label = getText(labelText);
// Identify if footnote
if (!isShortcut && !isFullOrCollapsed) {
const [ footnoteCallMarker, footnoteCallString ] = token.children.filter(
@ -453,7 +460,7 @@ function getReferenceLinkImageData(tokens) {
}
// Track link (handle shortcuts separately due to ambiguity in "text [text] text")
if (isShortcut || isFullOrCollapsed) {
addReferenceToDictionary(token, referenceString?.text || label, isShortcut);
addReferenceToDictionary(token, getText(referenceString) || label, isShortcut);
}
}
break;

View file

@ -2,10 +2,13 @@
"use strict";
const { flatTokensSymbol, htmlFlowSymbol } = require("./shared.js");
const { flatTokensSymbol, htmlFlowSymbol } = require("./shared.cjs");
/** @typedef {import("markdownlint-micromark").TokenType} TokenType */
/** @typedef {import("../lib/markdownlint.js").MicromarkToken} Token */
// eslint-disable-next-line jsdoc/valid-types
/** @typedef {import("micromark-util-types", { with: { "resolution-mode": "import" } }).TokenType} TokenType */
/** @typedef {import("../lib/exports.mjs").MicromarkToken} Token */
// eslint-disable-next-line jsdoc/valid-types
/** @typedef {import("../lib/micromark-types.d.mts", { with: { "resolution-mode": "import" } })} */
/**
* Determines if a Micromark token is within an htmlFlow type.
@ -76,12 +79,11 @@ function addRangeToSet(set, start, end) {
* Filter a list of Micromark tokens by predicate.
*
* @param {Token[]} tokens Micromark tokens.
* @param {AllowedPredicate} [allowed] Allowed token predicate.
* @param {AllowedPredicate} allowed Allowed token predicate.
* @param {TransformPredicate} [transformChildren] Transform predicate.
* @returns {Token[]} Filtered tokens.
*/
function filterByPredicate(tokens, allowed, transformChildren) {
allowed = allowed || (() => true);
const result = [];
const queue = [
{
@ -214,8 +216,12 @@ function getHeadingStyle(heading) {
* @returns {string} Heading text.
*/
function getHeadingText(heading) {
const headingTexts = getDescendantsByType(heading, [ [ "atxHeadingText", "setextHeadingText" ] ]);
return headingTexts[0]?.text.replace(/[\r\n]+/g, " ") || "";
const headingText = getDescendantsByType(heading, [ [ "atxHeadingText", "setextHeadingText" ] ])
.flatMap((descendant) => descendant.children.filter((child) => child.type !== "htmlText"))
.map((data) => data.text)
.join("")
.replace(/[\r\n]+/g, " ");
return headingText || "";
}
/**
@ -264,6 +270,26 @@ function getParentOfType(token, types) {
return current;
}
const docfxTabSyntaxRe = /^#tab\//;
/**
* Returns whether the specified Micromark token looks like a Docfx tab.
*
* @param {Token | null} heading Micromark token.
* @returns {boolean} True iff the token looks like a Docfx tab.
*/
function isDocfxTab(heading) {
// See https://dotnet.github.io/docfx/docs/markdown.html?tabs=linux%2Cdotnet#tabs
if (heading?.type === "atxHeading") {
const headingTexts = getDescendantsByType(heading, [ "atxHeadingText" ]);
if ((headingTexts.length === 1) && (headingTexts[0].children.length === 1) && (headingTexts[0].children[0].type === "link")) {
const resourceDestinationStrings = filterByTypes(headingTexts[0].children[0].children, [ "resourceDestinationString" ]);
return (resourceDestinationStrings.length === 1) && docfxTabSyntaxRe.test(resourceDestinationStrings[0].text);
}
}
return false;
}
/**
* Set containing token types that do not contain content.
*
@ -276,7 +302,11 @@ const nonContentTokens = new Set([
"lineEnding",
"lineEndingBlank",
"linePrefix",
"listItemIndent"
"listItemIndent",
"undefinedReference",
"undefinedReferenceCollapsed",
"undefinedReferenceFull",
"undefinedReferenceShortcut"
]);
module.exports = {
@ -291,6 +321,7 @@ module.exports = {
getHtmlTagInfo,
getParentOfType,
inHtmlFlow,
isDocfxTab,
isHtmlFlowComment,
nonContentTokens
};

View file

@ -1,10 +1,10 @@
{
"name": "markdownlint-rule-helpers",
"version": "0.27.0",
"version": "0.29.0",
"description": "A collection of markdownlint helper functions for custom rules",
"main": "./helpers.js",
"main": "./helpers.cjs",
"exports": {
".": "./helpers.js",
".": "./helpers.cjs",
"./micromark": "./micromark-helpers.cjs"
},
"author": "David Anson (https://dlaa.me/)",
@ -19,9 +19,6 @@
"engines": {
"node": ">=18"
},
"dependencies": {
"markdownlint-micromark": "0.1.2"
},
"keywords": [
"markdownlint",
"markdownlint-rule"

View file

@ -7,7 +7,7 @@ const test = require("ava").default;
const { "exports": packageExports, name } = require("../helpers/package.json");
const exportMappings = new Map([
[ ".", "../helpers/helpers.js" ],
[ ".", "../helpers/helpers.cjs" ],
[ "./micromark", "../helpers/micromark-helpers.cjs" ]
]);

View file

@ -1,70 +0,0 @@
// @ts-check
"use strict";
const helpers = require("../helpers");
const { filterByTypes } = require("../helpers/micromark-helpers.cjs");
/** @type {Map<string, object>} */
const map = new Map();
let params = undefined;
/**
* Initializes (resets) the cache.
*
* @param {import("./markdownlint").RuleParams} [p] Rule parameters object.
* @returns {void}
*/
function initialize(p) {
map.clear();
params = p;
}
/**
* Gets a cached object value - computes it and caches it.
*
* @param {string} name Cache object name.
* @param {Function} getValue Getter for object value.
* @returns {Object} Object value.
*/
function getCached(name, getValue) {
if (map.has(name)) {
return map.get(name);
}
const value = getValue();
map.set(name, value);
return value;
}
/**
* Filters a list of Micromark tokens by type and caches the result.
*
* @param {import("./markdownlint").MicromarkTokenType[]} types Types to allow.
* @param {boolean} [htmlFlow] Whether to include htmlFlow content.
* @returns {import("./markdownlint").MicromarkToken[]} Filtered tokens.
*/
function filterByTypesCached(types, htmlFlow) {
return getCached(
// eslint-disable-next-line prefer-rest-params
JSON.stringify(arguments),
() => filterByTypes(params.parsers.micromark.tokens, types, htmlFlow)
);
}
/**
* Gets a reference link and image data object.
*
* @returns {Object} Reference link and image data object.
*/
function getReferenceLinkImageData() {
return getCached(
getReferenceLinkImageData.name,
() => helpers.getReferenceLinkImageData(params.parsers.micromark.tokens)
);
}
module.exports = {
initialize,
filterByTypesCached,
getReferenceLinkImageData
};

76
lib/cache.mjs Normal file
View file

@ -0,0 +1,76 @@
// @ts-check
import { getReferenceLinkImageData as helpersGetReferenceLinkImageData } from "../helpers/helpers.cjs";
import { filterByTypes } from "../helpers/micromark-helpers.cjs";
/** @typedef {import("markdownlint").RuleParams} RuleParams */
/** @typedef {import("markdownlint").MicromarkToken} MicromarkToken */
/** @typedef {import("markdownlint").MicromarkTokenType} MicromarkTokenType */
/** @type {Map<string, object>} */
const map = new Map();
/** @type {RuleParams | undefined} */
let params = undefined;
/**
* Initializes (resets) the cache.
*
* @param {RuleParams} [p] Rule parameters object.
* @returns {void}
*/
export function initialize(p) {
map.clear();
params = p;
}
/**
* Gets the cached Micromark token array (for testing).
*
* @returns {MicromarkToken[]} Micromark tokens.
*/
export function micromarkTokens() {
return params?.parsers.micromark.tokens || [];
}
/**
* Gets a cached object value - computes it and caches it.
*
* @param {string} name Cache object name.
* @param {Function} getValue Getter for object value.
* @returns {Object} Object value.
*/
function getCached(name, getValue) {
if (map.has(name)) {
return map.get(name);
}
const value = getValue();
map.set(name, value);
return value;
}
/**
* Filters a list of Micromark tokens by type and caches the result.
*
* @param {MicromarkTokenType[]} types Types to allow.
* @param {boolean} [htmlFlow] Whether to include htmlFlow content.
* @returns {MicromarkToken[]} Filtered tokens.
*/
export function filterByTypesCached(types, htmlFlow) {
return getCached(
// eslint-disable-next-line prefer-rest-params
JSON.stringify(arguments),
() => filterByTypes(micromarkTokens(), types, htmlFlow)
);
}
/**
* Gets a reference link and image data object.
*
* @returns {Object} Reference link and image data object.
*/
export function getReferenceLinkImageData() {
return getCached(
getReferenceLinkImageData.name,
() => helpersGetReferenceLinkImageData(micromarkTokens())
);
}

View file

@ -19,15 +19,15 @@ export interface ConfigurationStrict {
*/
extends?: string | null;
/**
* MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md001.md
* MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md
*/
MD001?: boolean;
/**
* MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md001.md
* MD001/heading-increment : Heading levels should only increment by one level at a time : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md001.md
*/
"heading-increment"?: boolean;
/**
* MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md003.md
* MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md003.md
*/
MD003?:
| boolean
@ -38,7 +38,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "atx" | "atx_closed" | "setext" | "setext_with_atx" | "setext_with_atx_closed";
};
/**
* MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md003.md
* MD003/heading-style : Heading style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md003.md
*/
"heading-style"?:
| boolean
@ -49,7 +49,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "atx" | "atx_closed" | "setext" | "setext_with_atx" | "setext_with_atx_closed";
};
/**
* MD004/ul-style : Unordered list style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md004.md
* MD004/ul-style : Unordered list style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md004.md
*/
MD004?:
| boolean
@ -60,7 +60,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "asterisk" | "plus" | "dash" | "sublist";
};
/**
* MD004/ul-style : Unordered list style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md004.md
* MD004/ul-style : Unordered list style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md004.md
*/
"ul-style"?:
| boolean
@ -71,15 +71,15 @@ export interface ConfigurationStrict {
style?: "consistent" | "asterisk" | "plus" | "dash" | "sublist";
};
/**
* MD005/list-indent : Inconsistent indentation for list items at the same level : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md005.md
* MD005/list-indent : Inconsistent indentation for list items at the same level : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md005.md
*/
MD005?: boolean;
/**
* MD005/list-indent : Inconsistent indentation for list items at the same level : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md005.md
* MD005/list-indent : Inconsistent indentation for list items at the same level : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md005.md
*/
"list-indent"?: boolean;
/**
* MD007/ul-indent : Unordered list indentation : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md007.md
* MD007/ul-indent : Unordered list indentation : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md007.md
*/
MD007?:
| boolean
@ -98,7 +98,7 @@ export interface ConfigurationStrict {
start_indent?: number;
};
/**
* MD007/ul-indent : Unordered list indentation : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md007.md
* MD007/ul-indent : Unordered list indentation : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md007.md
*/
"ul-indent"?:
| boolean
@ -117,7 +117,7 @@ export interface ConfigurationStrict {
start_indent?: number;
};
/**
* MD009/no-trailing-spaces : Trailing spaces : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md009.md
* MD009/no-trailing-spaces : Trailing spaces : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md009.md
*/
MD009?:
| boolean
@ -136,7 +136,7 @@ export interface ConfigurationStrict {
strict?: boolean;
};
/**
* MD009/no-trailing-spaces : Trailing spaces : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md009.md
* MD009/no-trailing-spaces : Trailing spaces : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md009.md
*/
"no-trailing-spaces"?:
| boolean
@ -155,7 +155,7 @@ export interface ConfigurationStrict {
strict?: boolean;
};
/**
* MD010/no-hard-tabs : Hard tabs : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md010.md
* MD010/no-hard-tabs : Hard tabs : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md010.md
*/
MD010?:
| boolean
@ -174,7 +174,7 @@ export interface ConfigurationStrict {
spaces_per_tab?: number;
};
/**
* MD010/no-hard-tabs : Hard tabs : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md010.md
* MD010/no-hard-tabs : Hard tabs : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md010.md
*/
"no-hard-tabs"?:
| boolean
@ -193,15 +193,15 @@ export interface ConfigurationStrict {
spaces_per_tab?: number;
};
/**
* MD011/no-reversed-links : Reversed link syntax : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md011.md
* MD011/no-reversed-links : Reversed link syntax : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md011.md
*/
MD011?: boolean;
/**
* MD011/no-reversed-links : Reversed link syntax : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md011.md
* MD011/no-reversed-links : Reversed link syntax : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md011.md
*/
"no-reversed-links"?: boolean;
/**
* MD012/no-multiple-blanks : Multiple consecutive blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md012.md
* MD012/no-multiple-blanks : Multiple consecutive blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md012.md
*/
MD012?:
| boolean
@ -212,7 +212,7 @@ export interface ConfigurationStrict {
maximum?: number;
};
/**
* MD012/no-multiple-blanks : Multiple consecutive blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md012.md
* MD012/no-multiple-blanks : Multiple consecutive blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md012.md
*/
"no-multiple-blanks"?:
| boolean
@ -223,7 +223,7 @@ export interface ConfigurationStrict {
maximum?: number;
};
/**
* MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md013.md
* MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md
*/
MD013?:
| boolean
@ -262,7 +262,7 @@ export interface ConfigurationStrict {
stern?: boolean;
};
/**
* MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md013.md
* MD013/line-length : Line length : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md013.md
*/
"line-length"?:
| boolean
@ -301,47 +301,47 @@ export interface ConfigurationStrict {
stern?: boolean;
};
/**
* MD014/commands-show-output : Dollar signs used before commands without showing output : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md014.md
* MD014/commands-show-output : Dollar signs used before commands without showing output : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md014.md
*/
MD014?: boolean;
/**
* MD014/commands-show-output : Dollar signs used before commands without showing output : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md014.md
* MD014/commands-show-output : Dollar signs used before commands without showing output : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md014.md
*/
"commands-show-output"?: boolean;
/**
* MD018/no-missing-space-atx : No space after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md018.md
* MD018/no-missing-space-atx : No space after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md018.md
*/
MD018?: boolean;
/**
* MD018/no-missing-space-atx : No space after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md018.md
* MD018/no-missing-space-atx : No space after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md018.md
*/
"no-missing-space-atx"?: boolean;
/**
* MD019/no-multiple-space-atx : Multiple spaces after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md019.md
* MD019/no-multiple-space-atx : Multiple spaces after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md019.md
*/
MD019?: boolean;
/**
* MD019/no-multiple-space-atx : Multiple spaces after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md019.md
* MD019/no-multiple-space-atx : Multiple spaces after hash on atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md019.md
*/
"no-multiple-space-atx"?: boolean;
/**
* MD020/no-missing-space-closed-atx : No space inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md020.md
* MD020/no-missing-space-closed-atx : No space inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md020.md
*/
MD020?: boolean;
/**
* MD020/no-missing-space-closed-atx : No space inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md020.md
* MD020/no-missing-space-closed-atx : No space inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md020.md
*/
"no-missing-space-closed-atx"?: boolean;
/**
* MD021/no-multiple-space-closed-atx : Multiple spaces inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md021.md
* MD021/no-multiple-space-closed-atx : Multiple spaces inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md021.md
*/
MD021?: boolean;
/**
* MD021/no-multiple-space-closed-atx : Multiple spaces inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md021.md
* MD021/no-multiple-space-closed-atx : Multiple spaces inside hashes on closed atx style heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md021.md
*/
"no-multiple-space-closed-atx"?: boolean;
/**
* MD022/blanks-around-headings : Headings should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md022.md
* MD022/blanks-around-headings : Headings should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
*/
MD022?:
| boolean
@ -356,7 +356,7 @@ export interface ConfigurationStrict {
lines_below?: number | number[];
};
/**
* MD022/blanks-around-headings : Headings should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md022.md
* MD022/blanks-around-headings : Headings should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
*/
"blanks-around-headings"?:
| boolean
@ -371,15 +371,15 @@ export interface ConfigurationStrict {
lines_below?: number | number[];
};
/**
* MD023/heading-start-left : Headings must start at the beginning of the line : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md023.md
* MD023/heading-start-left : Headings must start at the beginning of the line : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md023.md
*/
MD023?: boolean;
/**
* MD023/heading-start-left : Headings must start at the beginning of the line : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md023.md
* MD023/heading-start-left : Headings must start at the beginning of the line : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md023.md
*/
"heading-start-left"?: boolean;
/**
* MD024/no-duplicate-heading : Multiple headings with the same content : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md024.md
* MD024/no-duplicate-heading : Multiple headings with the same content : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md024.md
*/
MD024?:
| boolean
@ -390,7 +390,7 @@ export interface ConfigurationStrict {
siblings_only?: boolean;
};
/**
* MD024/no-duplicate-heading : Multiple headings with the same content : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md024.md
* MD024/no-duplicate-heading : Multiple headings with the same content : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md024.md
*/
"no-duplicate-heading"?:
| boolean
@ -401,52 +401,52 @@ export interface ConfigurationStrict {
siblings_only?: boolean;
};
/**
* MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md025.md
* MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md025.md
*/
MD025?:
| boolean
| {
/**
* Heading level
*/
level?: number;
/**
* RegExp for matching title in front matter
*/
front_matter_title?: string;
/**
* Heading level
*/
level?: number;
};
/**
* MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md025.md
* MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md025.md
*/
"single-title"?:
| boolean
| {
/**
* Heading level
*/
level?: number;
/**
* RegExp for matching title in front matter
*/
front_matter_title?: string;
/**
* Heading level
*/
level?: number;
};
/**
* MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md025.md
* MD025/single-title/single-h1 : Multiple top-level headings in the same document : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md025.md
*/
"single-h1"?:
| boolean
| {
/**
* Heading level
*/
level?: number;
/**
* RegExp for matching title in front matter
*/
front_matter_title?: string;
/**
* Heading level
*/
level?: number;
};
/**
* MD026/no-trailing-punctuation : Trailing punctuation in heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md026.md
* MD026/no-trailing-punctuation : Trailing punctuation in heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md026.md
*/
MD026?:
| boolean
@ -457,7 +457,7 @@ export interface ConfigurationStrict {
punctuation?: string;
};
/**
* MD026/no-trailing-punctuation : Trailing punctuation in heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md026.md
* MD026/no-trailing-punctuation : Trailing punctuation in heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md026.md
*/
"no-trailing-punctuation"?:
| boolean
@ -468,23 +468,37 @@ export interface ConfigurationStrict {
punctuation?: string;
};
/**
* MD027/no-multiple-space-blockquote : Multiple spaces after blockquote symbol : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md027.md
* MD027/no-multiple-space-blockquote : Multiple spaces after blockquote symbol : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md027.md
*/
MD027?: boolean;
MD027?:
| boolean
| {
/**
* Include list items
*/
list_items?: boolean;
};
/**
* MD027/no-multiple-space-blockquote : Multiple spaces after blockquote symbol : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md027.md
* MD027/no-multiple-space-blockquote : Multiple spaces after blockquote symbol : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md027.md
*/
"no-multiple-space-blockquote"?: boolean;
"no-multiple-space-blockquote"?:
| boolean
| {
/**
* Include list items
*/
list_items?: boolean;
};
/**
* MD028/no-blanks-blockquote : Blank line inside blockquote : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md028.md
* MD028/no-blanks-blockquote : Blank line inside blockquote : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md028.md
*/
MD028?: boolean;
/**
* MD028/no-blanks-blockquote : Blank line inside blockquote : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md028.md
* MD028/no-blanks-blockquote : Blank line inside blockquote : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md028.md
*/
"no-blanks-blockquote"?: boolean;
/**
* MD029/ol-prefix : Ordered list item prefix : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md029.md
* MD029/ol-prefix : Ordered list item prefix : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md029.md
*/
MD029?:
| boolean
@ -495,7 +509,7 @@ export interface ConfigurationStrict {
style?: "one" | "ordered" | "one_or_ordered" | "zero";
};
/**
* MD029/ol-prefix : Ordered list item prefix : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md029.md
* MD029/ol-prefix : Ordered list item prefix : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md029.md
*/
"ol-prefix"?:
| boolean
@ -506,7 +520,7 @@ export interface ConfigurationStrict {
style?: "one" | "ordered" | "one_or_ordered" | "zero";
};
/**
* MD030/list-marker-space : Spaces after list markers : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md030.md
* MD030/list-marker-space : Spaces after list markers : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md030.md
*/
MD030?:
| boolean
@ -529,7 +543,7 @@ export interface ConfigurationStrict {
ol_multi?: number;
};
/**
* MD030/list-marker-space : Spaces after list markers : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md030.md
* MD030/list-marker-space : Spaces after list markers : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md030.md
*/
"list-marker-space"?:
| boolean
@ -552,7 +566,7 @@ export interface ConfigurationStrict {
ol_multi?: number;
};
/**
* MD031/blanks-around-fences : Fenced code blocks should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md031.md
* MD031/blanks-around-fences : Fenced code blocks should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
*/
MD031?:
| boolean
@ -563,7 +577,7 @@ export interface ConfigurationStrict {
list_items?: boolean;
};
/**
* MD031/blanks-around-fences : Fenced code blocks should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md031.md
* MD031/blanks-around-fences : Fenced code blocks should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
*/
"blanks-around-fences"?:
| boolean
@ -574,15 +588,15 @@ export interface ConfigurationStrict {
list_items?: boolean;
};
/**
* MD032/blanks-around-lists : Lists should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md032.md
* MD032/blanks-around-lists : Lists should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md
*/
MD032?: boolean;
/**
* MD032/blanks-around-lists : Lists should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md032.md
* MD032/blanks-around-lists : Lists should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md032.md
*/
"blanks-around-lists"?: boolean;
/**
* MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md033.md
* MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md033.md
*/
MD033?:
| boolean
@ -593,7 +607,7 @@ export interface ConfigurationStrict {
allowed_elements?: string[];
};
/**
* MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md033.md
* MD033/no-inline-html : Inline HTML : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md033.md
*/
"no-inline-html"?:
| boolean
@ -604,15 +618,15 @@ export interface ConfigurationStrict {
allowed_elements?: string[];
};
/**
* MD034/no-bare-urls : Bare URL used : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md034.md
* MD034/no-bare-urls : Bare URL used : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md034.md
*/
MD034?: boolean;
/**
* MD034/no-bare-urls : Bare URL used : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md034.md
* MD034/no-bare-urls : Bare URL used : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md034.md
*/
"no-bare-urls"?: boolean;
/**
* MD035/hr-style : Horizontal rule style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md035.md
* MD035/hr-style : Horizontal rule style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md035.md
*/
MD035?:
| boolean
@ -623,7 +637,7 @@ export interface ConfigurationStrict {
style?: string;
};
/**
* MD035/hr-style : Horizontal rule style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md035.md
* MD035/hr-style : Horizontal rule style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md035.md
*/
"hr-style"?:
| boolean
@ -634,7 +648,7 @@ export interface ConfigurationStrict {
style?: string;
};
/**
* MD036/no-emphasis-as-heading : Emphasis used instead of a heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md036.md
* MD036/no-emphasis-as-heading : Emphasis used instead of a heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md036.md
*/
MD036?:
| boolean
@ -645,7 +659,7 @@ export interface ConfigurationStrict {
punctuation?: string;
};
/**
* MD036/no-emphasis-as-heading : Emphasis used instead of a heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md036.md
* MD036/no-emphasis-as-heading : Emphasis used instead of a heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md036.md
*/
"no-emphasis-as-heading"?:
| boolean
@ -656,31 +670,31 @@ export interface ConfigurationStrict {
punctuation?: string;
};
/**
* MD037/no-space-in-emphasis : Spaces inside emphasis markers : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md037.md
* MD037/no-space-in-emphasis : Spaces inside emphasis markers : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md037.md
*/
MD037?: boolean;
/**
* MD037/no-space-in-emphasis : Spaces inside emphasis markers : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md037.md
* MD037/no-space-in-emphasis : Spaces inside emphasis markers : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md037.md
*/
"no-space-in-emphasis"?: boolean;
/**
* MD038/no-space-in-code : Spaces inside code span elements : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md038.md
* MD038/no-space-in-code : Spaces inside code span elements : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md038.md
*/
MD038?: boolean;
/**
* MD038/no-space-in-code : Spaces inside code span elements : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md038.md
* MD038/no-space-in-code : Spaces inside code span elements : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md038.md
*/
"no-space-in-code"?: boolean;
/**
* MD039/no-space-in-links : Spaces inside link text : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md039.md
* MD039/no-space-in-links : Spaces inside link text : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md039.md
*/
MD039?: boolean;
/**
* MD039/no-space-in-links : Spaces inside link text : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md039.md
* MD039/no-space-in-links : Spaces inside link text : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md039.md
*/
"no-space-in-links"?: boolean;
/**
* MD040/fenced-code-language : Fenced code blocks should have a language specified : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md040.md
* MD040/fenced-code-language : Fenced code blocks should have a language specified : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md040.md
*/
MD040?:
| boolean
@ -695,7 +709,7 @@ export interface ConfigurationStrict {
language_only?: boolean;
};
/**
* MD040/fenced-code-language : Fenced code blocks should have a language specified : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md040.md
* MD040/fenced-code-language : Fenced code blocks should have a language specified : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md040.md
*/
"fenced-code-language"?:
| boolean
@ -710,60 +724,72 @@ export interface ConfigurationStrict {
language_only?: boolean;
};
/**
* MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md041.md
* MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md041.md
*/
MD041?:
| boolean
| {
/**
* Heading level
* Allow content before first heading
*/
level?: number;
allow_preamble?: boolean;
/**
* RegExp for matching title in front matter
*/
front_matter_title?: string;
/**
* Heading level
*/
level?: number;
};
/**
* MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md041.md
* MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md041.md
*/
"first-line-heading"?:
| boolean
| {
/**
* Heading level
* Allow content before first heading
*/
level?: number;
allow_preamble?: boolean;
/**
* RegExp for matching title in front matter
*/
front_matter_title?: string;
/**
* Heading level
*/
level?: number;
};
/**
* MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md041.md
* MD041/first-line-heading/first-line-h1 : First line in a file should be a top-level heading : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md041.md
*/
"first-line-h1"?:
| boolean
| {
/**
* Heading level
* Allow content before first heading
*/
level?: number;
allow_preamble?: boolean;
/**
* RegExp for matching title in front matter
*/
front_matter_title?: string;
/**
* Heading level
*/
level?: number;
};
/**
* MD042/no-empty-links : No empty links : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md042.md
* MD042/no-empty-links : No empty links : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md042.md
*/
MD042?: boolean;
/**
* MD042/no-empty-links : No empty links : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md042.md
* MD042/no-empty-links : No empty links : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md042.md
*/
"no-empty-links"?: boolean;
/**
* MD043/required-headings : Required heading structure : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md043.md
* MD043/required-headings : Required heading structure : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md043.md
*/
MD043?:
| boolean
@ -778,7 +804,7 @@ export interface ConfigurationStrict {
match_case?: boolean;
};
/**
* MD043/required-headings : Required heading structure : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md043.md
* MD043/required-headings : Required heading structure : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md043.md
*/
"required-headings"?:
| boolean
@ -793,7 +819,7 @@ export interface ConfigurationStrict {
match_case?: boolean;
};
/**
* MD044/proper-names : Proper names should have the correct capitalization : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md044.md
* MD044/proper-names : Proper names should have the correct capitalization : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md044.md
*/
MD044?:
| boolean
@ -812,7 +838,7 @@ export interface ConfigurationStrict {
html_elements?: boolean;
};
/**
* MD044/proper-names : Proper names should have the correct capitalization : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md044.md
* MD044/proper-names : Proper names should have the correct capitalization : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md044.md
*/
"proper-names"?:
| boolean
@ -831,15 +857,15 @@ export interface ConfigurationStrict {
html_elements?: boolean;
};
/**
* MD045/no-alt-text : Images should have alternate text (alt text) : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md045.md
* MD045/no-alt-text : Images should have alternate text (alt text) : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md045.md
*/
MD045?: boolean;
/**
* MD045/no-alt-text : Images should have alternate text (alt text) : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md045.md
* MD045/no-alt-text : Images should have alternate text (alt text) : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md045.md
*/
"no-alt-text"?: boolean;
/**
* MD046/code-block-style : Code block style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md046.md
* MD046/code-block-style : Code block style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md
*/
MD046?:
| boolean
@ -850,7 +876,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "fenced" | "indented";
};
/**
* MD046/code-block-style : Code block style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md046.md
* MD046/code-block-style : Code block style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md046.md
*/
"code-block-style"?:
| boolean
@ -861,15 +887,15 @@ export interface ConfigurationStrict {
style?: "consistent" | "fenced" | "indented";
};
/**
* MD047/single-trailing-newline : Files should end with a single newline character : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md047.md
* MD047/single-trailing-newline : Files should end with a single newline character : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md047.md
*/
MD047?: boolean;
/**
* MD047/single-trailing-newline : Files should end with a single newline character : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md047.md
* MD047/single-trailing-newline : Files should end with a single newline character : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md047.md
*/
"single-trailing-newline"?: boolean;
/**
* MD048/code-fence-style : Code fence style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md048.md
* MD048/code-fence-style : Code fence style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md048.md
*/
MD048?:
| boolean
@ -880,7 +906,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "backtick" | "tilde";
};
/**
* MD048/code-fence-style : Code fence style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md048.md
* MD048/code-fence-style : Code fence style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md048.md
*/
"code-fence-style"?:
| boolean
@ -891,7 +917,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "backtick" | "tilde";
};
/**
* MD049/emphasis-style : Emphasis style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md049.md
* MD049/emphasis-style : Emphasis style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md049.md
*/
MD049?:
| boolean
@ -902,7 +928,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "asterisk" | "underscore";
};
/**
* MD049/emphasis-style : Emphasis style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md049.md
* MD049/emphasis-style : Emphasis style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md049.md
*/
"emphasis-style"?:
| boolean
@ -913,7 +939,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "asterisk" | "underscore";
};
/**
* MD050/strong-style : Strong style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md050.md
* MD050/strong-style : Strong style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md050.md
*/
MD050?:
| boolean
@ -924,7 +950,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "asterisk" | "underscore";
};
/**
* MD050/strong-style : Strong style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md050.md
* MD050/strong-style : Strong style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md050.md
*/
"strong-style"?:
| boolean
@ -935,7 +961,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "asterisk" | "underscore";
};
/**
* MD051/link-fragments : Link fragments should be valid : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md051.md
* MD051/link-fragments : Link fragments should be valid : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md051.md
*/
MD051?:
| boolean
@ -944,9 +970,13 @@ export interface ConfigurationStrict {
* Ignore case of fragments
*/
ignore_case?: boolean;
/**
* Pattern for ignoring additional fragments
*/
ignored_pattern?: string;
};
/**
* MD051/link-fragments : Link fragments should be valid : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md051.md
* MD051/link-fragments : Link fragments should be valid : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md051.md
*/
"link-fragments"?:
| boolean
@ -955,31 +985,43 @@ export interface ConfigurationStrict {
* Ignore case of fragments
*/
ignore_case?: boolean;
/**
* Pattern for ignoring additional fragments
*/
ignored_pattern?: string;
};
/**
* MD052/reference-links-images : Reference links and images should use a label that is defined : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md052.md
* MD052/reference-links-images : Reference links and images should use a label that is defined : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md052.md
*/
MD052?:
| boolean
| {
/**
* Include shortcut syntax
* Ignored link labels
*/
shortcut_syntax?: boolean;
};
/**
* MD052/reference-links-images : Reference links and images should use a label that is defined : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md052.md
*/
"reference-links-images"?:
| boolean
| {
ignored_labels?: string[];
/**
* Include shortcut syntax
*/
shortcut_syntax?: boolean;
};
/**
* MD053/link-image-reference-definitions : Link and image reference definitions should be needed : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md053.md
* MD052/reference-links-images : Reference links and images should use a label that is defined : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md052.md
*/
"reference-links-images"?:
| boolean
| {
/**
* Ignored link labels
*/
ignored_labels?: string[];
/**
* Include shortcut syntax
*/
shortcut_syntax?: boolean;
};
/**
* MD053/link-image-reference-definitions : Link and image reference definitions should be needed : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md053.md
*/
MD053?:
| boolean
@ -990,7 +1032,7 @@ export interface ConfigurationStrict {
ignored_definitions?: string[];
};
/**
* MD053/link-image-reference-definitions : Link and image reference definitions should be needed : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md053.md
* MD053/link-image-reference-definitions : Link and image reference definitions should be needed : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md053.md
*/
"link-image-reference-definitions"?:
| boolean
@ -1001,7 +1043,7 @@ export interface ConfigurationStrict {
ignored_definitions?: string[];
};
/**
* MD054/link-image-style : Link and image style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md054.md
* MD054/link-image-style : Link and image style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md054.md
*/
MD054?:
| boolean
@ -1032,7 +1074,7 @@ export interface ConfigurationStrict {
url_inline?: boolean;
};
/**
* MD054/link-image-style : Link and image style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md054.md
* MD054/link-image-style : Link and image style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md054.md
*/
"link-image-style"?:
| boolean
@ -1063,7 +1105,7 @@ export interface ConfigurationStrict {
url_inline?: boolean;
};
/**
* MD055/table-pipe-style : Table pipe style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md055.md
* MD055/table-pipe-style : Table pipe style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md055.md
*/
MD055?:
| boolean
@ -1074,7 +1116,7 @@ export interface ConfigurationStrict {
style?: "consistent" | "leading_only" | "trailing_only" | "leading_and_trailing" | "no_leading_or_trailing";
};
/**
* MD055/table-pipe-style : Table pipe style : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md055.md
* MD055/table-pipe-style : Table pipe style : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md055.md
*/
"table-pipe-style"?:
| boolean
@ -1085,21 +1127,43 @@ export interface ConfigurationStrict {
style?: "consistent" | "leading_only" | "trailing_only" | "leading_and_trailing" | "no_leading_or_trailing";
};
/**
* MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md056.md
* MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md056.md
*/
MD056?: boolean;
/**
* MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md056.md
* MD056/table-column-count : Table column count : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md056.md
*/
"table-column-count"?: boolean;
/**
* MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md058.md
* MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md058.md
*/
MD058?: boolean;
/**
* MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md058.md
* MD058/blanks-around-tables : Tables should be surrounded by blank lines : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md058.md
*/
"blanks-around-tables"?: boolean;
/**
* MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md
*/
MD059?:
| boolean
| {
/**
* Prohibited link texts
*/
prohibited_texts?: string[];
};
/**
* MD059/descriptive-link-text : Link text should be descriptive : https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md059.md
*/
"descriptive-link-text"?:
| boolean
| {
/**
* Prohibited link texts
*/
prohibited_texts?: string[];
};
/**
* headings : MD001, MD003, MD018, MD019, MD020, MD021, MD022, MD023, MD024, MD025, MD026, MD036, MD041, MD043
*/
@ -1125,7 +1189,7 @@ export interface ConfigurationStrict {
*/
hard_tab?: boolean;
/**
* links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054
* links : MD011, MD034, MD039, MD042, MD051, MD052, MD053, MD054, MD059
*/
links?: boolean;
/**
@ -1185,7 +1249,7 @@ export interface ConfigurationStrict {
*/
spelling?: boolean;
/**
* accessibility : MD045
* accessibility : MD045, MD059
*/
accessibility?: boolean;
/**

View file

@ -1,4 +1,4 @@
import { ConfigurationStrict } from "./configuration-strict";
import type { ConfigurationStrict } from "./configuration-strict.d.ts";
export interface Configuration extends ConfigurationStrict {
/**

View file

@ -1,9 +1,7 @@
// @ts-check
"use strict";
module.exports.deprecatedRuleNames = [];
module.exports.fixableRuleNames = [
export const deprecatedRuleNames = [];
export const fixableRuleNames = [
"MD004", "MD005", "MD007", "MD009", "MD010", "MD011",
"MD012", "MD014", "MD018", "MD019", "MD020", "MD021",
"MD022", "MD023", "MD026", "MD027", "MD030", "MD031",
@ -11,5 +9,5 @@ module.exports.fixableRuleNames = [
"MD047", "MD049", "MD050", "MD051", "MD053", "MD054",
"MD058"
];
module.exports.homepage = "https://github.com/DavidAnson/markdownlint";
module.exports.version = "0.36.1";
export const homepage = "https://github.com/DavidAnson/markdownlint";
export const version = "0.38.0";

16
lib/defer-require.cjs Normal file
View file

@ -0,0 +1,16 @@
// @ts-check
"use strict";
/**
* Calls require for markdownit.cjs. Used to synchronously defer loading because module.createRequire is buggy under webpack (https://github.com/webpack/webpack/issues/16724).
*
* @returns {any} Exported module content.
*/
function requireMarkdownItCjs() {
return require("./markdownit.cjs");
}
module.exports = {
requireMarkdownItCjs
};

1
lib/exports-async.d.mts Normal file
View file

@ -0,0 +1 @@
export { lintAsync as lint, readConfigAsync as readConfig } from "./markdownlint.mjs";

3
lib/exports-async.mjs Normal file
View file

@ -0,0 +1,3 @@
// @ts-check
export { lintAsync as lint, readConfigAsync as readConfig } from "./markdownlint.mjs";

View file

@ -0,0 +1 @@
export { extendConfigPromise as extendConfig, lintPromise as lint, readConfigPromise as readConfig } from "./markdownlint.mjs";

3
lib/exports-promise.mjs Normal file
View file

@ -0,0 +1,3 @@
// @ts-check
export { extendConfigPromise as extendConfig, lintPromise as lint, readConfigPromise as readConfig } from "./markdownlint.mjs";

1
lib/exports-sync.d.mts Normal file
View file

@ -0,0 +1 @@
export { lintSync as lint, readConfigSync as readConfig } from "./markdownlint.mjs";

3
lib/exports-sync.mjs Normal file
View file

@ -0,0 +1,3 @@
// @ts-check
export { lintSync as lint, readConfigSync as readConfig } from "./markdownlint.mjs";

30
lib/exports.d.mts Normal file
View file

@ -0,0 +1,30 @@
export { resolveModule } from "./resolve-module.cjs";
export type Configuration = import("./markdownlint.mjs").Configuration;
export type ConfigurationParser = import("./markdownlint.mjs").ConfigurationParser;
export type ConfigurationStrict = import("./markdownlint.mjs").ConfigurationStrict;
export type FixInfo = import("./markdownlint.mjs").FixInfo;
export type LintCallback = import("./markdownlint.mjs").LintCallback;
export type LintContentCallback = import("./markdownlint.mjs").LintContentCallback;
export type LintError = import("./markdownlint.mjs").LintError;
export type LintResults = import("./markdownlint.mjs").LintResults;
export type MarkdownItFactory = import("./markdownlint.mjs").MarkdownItFactory;
export type MarkdownItToken = import("./markdownlint.mjs").MarkdownItToken;
export type MarkdownParsers = import("./markdownlint.mjs").MarkdownParsers;
export type MicromarkToken = import("./markdownlint.mjs").MicromarkToken;
export type MicromarkTokenType = import("./markdownlint.mjs").MicromarkTokenType;
export type Options = import("./markdownlint.mjs").Options;
export type ParserMarkdownIt = import("./markdownlint.mjs").ParserMarkdownIt;
export type ParserMicromark = import("./markdownlint.mjs").ParserMicromark;
export type Plugin = import("./markdownlint.mjs").Plugin;
export type ReadConfigCallback = import("./markdownlint.mjs").ReadConfigCallback;
export type ResolveConfigExtendsCallback = import("./markdownlint.mjs").ResolveConfigExtendsCallback;
export type Rule = import("./markdownlint.mjs").Rule;
export type RuleConfiguration = import("./markdownlint.mjs").RuleConfiguration;
export type RuleFunction = import("./markdownlint.mjs").RuleFunction;
export type RuleOnError = import("./markdownlint.mjs").RuleOnError;
export type RuleOnErrorFixInfo = import("./markdownlint.mjs").RuleOnErrorFixInfo;
export type RuleOnErrorFixInfoNormalized = import("./markdownlint.mjs").RuleOnErrorFixInfoNormalized;
export type RuleOnErrorInfo = import("./markdownlint.mjs").RuleOnErrorInfo;
export type RuleParams = import("./markdownlint.mjs").RuleParams;
export type ToStringCallback = import("./markdownlint.mjs").ToStringCallback;
export { applyFix, applyFixes, getVersion } from "./markdownlint.mjs";

33
lib/exports.mjs Normal file
View file

@ -0,0 +1,33 @@
// @ts-check
export { applyFix, applyFixes, getVersion } from "./markdownlint.mjs";
export { resolveModule } from "./resolve-module.cjs";
/** @typedef {import("./markdownlint.mjs").Configuration} Configuration */
/** @typedef {import("./markdownlint.mjs").ConfigurationParser} ConfigurationParser */
/** @typedef {import("./markdownlint.mjs").ConfigurationStrict} ConfigurationStrict */
/** @typedef {import("./markdownlint.mjs").FixInfo} FixInfo */
/** @typedef {import("./markdownlint.mjs").LintCallback} LintCallback */
/** @typedef {import("./markdownlint.mjs").LintContentCallback} LintContentCallback */
/** @typedef {import("./markdownlint.mjs").LintError} LintError */
/** @typedef {import("./markdownlint.mjs").LintResults} LintResults */
/** @typedef {import("./markdownlint.mjs").MarkdownItFactory} MarkdownItFactory */
/** @typedef {import("./markdownlint.mjs").MarkdownItToken} MarkdownItToken */
/** @typedef {import("./markdownlint.mjs").MarkdownParsers} MarkdownParsers */
/** @typedef {import("./markdownlint.mjs").MicromarkToken} MicromarkToken */
/** @typedef {import("./markdownlint.mjs").MicromarkTokenType} MicromarkTokenType */
/** @typedef {import("./markdownlint.mjs").Options} Options */
/** @typedef {import("./markdownlint.mjs").ParserMarkdownIt} ParserMarkdownIt */
/** @typedef {import("./markdownlint.mjs").ParserMicromark} ParserMicromark */
/** @typedef {import("./markdownlint.mjs").Plugin} Plugin */
/** @typedef {import("./markdownlint.mjs").ReadConfigCallback} ReadConfigCallback */
/** @typedef {import("./markdownlint.mjs").ResolveConfigExtendsCallback} ResolveConfigExtendsCallback */
/** @typedef {import("./markdownlint.mjs").Rule} Rule */
/** @typedef {import("./markdownlint.mjs").RuleConfiguration} RuleConfiguration */
/** @typedef {import("./markdownlint.mjs").RuleFunction} RuleFunction */
/** @typedef {import("./markdownlint.mjs").RuleOnError} RuleOnError */
/** @typedef {import("./markdownlint.mjs").RuleOnErrorFixInfo} RuleOnErrorFixInfo */
/** @typedef {import("./markdownlint.mjs").RuleOnErrorFixInfoNormalized} RuleOnErrorFixInfoNormalized */
/** @typedef {import("./markdownlint.mjs").RuleOnErrorInfo} RuleOnErrorInfo */
/** @typedef {import("./markdownlint.mjs").RuleParams} RuleParams */
/** @typedef {import("./markdownlint.mjs").ToStringCallback} ToStringCallback */

View file

@ -4,6 +4,11 @@
const { newLineRe } = require("../helpers");
// @ts-expect-error https://github.com/microsoft/TypeScript/issues/52529
/** @typedef {import("markdownlint").MarkdownIt} MarkdownIt */
/** @typedef {import("markdownlint").MarkdownItToken} MarkdownItToken */
/** @typedef {import("markdownlint").Plugin} Plugin */
/**
* @callback InlineCodeSpanCallback
* @param {string} code Code content.
@ -67,7 +72,7 @@ function forEachInlineCodeSpan(input, handler) {
/**
* Freeze all freeze-able members of a token and its children.
*
* @param {import("./markdownlint").MarkdownItToken} token A markdown-it token.
* @param {MarkdownItToken} token A markdown-it token.
* @returns {void}
*/
function freezeToken(token) {
@ -92,14 +97,13 @@ function freezeToken(token) {
/**
* Annotate tokens with line/lineNumber and freeze them.
*
* @param {Object[]} tokens Array of markdown-it tokens.
* @param {import("markdown-it").Token[]} tokens Array of markdown-it tokens.
* @param {string[]} lines Lines of Markdown content.
* @returns {void}
*/
function annotateAndFreezeTokens(tokens, lines) {
let trMap = null;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").MarkdownItToken[] */
/** @type {MarkdownItToken[]} */
// @ts-ignore
const markdownItTokens = tokens;
for (const token of markdownItTokens) {
@ -148,21 +152,14 @@ function annotateAndFreezeTokens(tokens, lines) {
/**
* Gets an array of markdown-it tokens for the input.
*
* @param {import("./markdownlint").Plugin[]} markdownItPlugins Additional plugins.
* @param {MarkdownIt} markdownIt Instance of the markdown-it parser.
* @param {string} content Markdown content.
* @param {string[]} lines Lines of Markdown content.
* @returns {import("../lib/markdownlint").MarkdownItToken} Array of markdown-it tokens.
* @returns {MarkdownItToken[]} Array of markdown-it tokens.
*/
function getMarkdownItTokens(markdownItPlugins, content, lines) {
const markdownit = require("markdown-it");
const md = markdownit({ "html": true });
for (const plugin of markdownItPlugins) {
// @ts-ignore
md.use(...plugin);
}
const tokens = md.parse(content, {});
function getMarkdownItTokens(markdownIt, content, lines) {
const tokens = markdownIt.parse(content, {});
annotateAndFreezeTokens(tokens, lines);
// @ts-ignore
return tokens;
};

View file

@ -1,4 +1,3 @@
export = markdownlint;
/**
* Lint specified Markdown files.
*
@ -6,49 +5,60 @@ export = markdownlint;
* @param {LintCallback} callback Callback (err, result) function.
* @returns {void}
*/
declare function markdownlint(options: Options | null, callback: LintCallback): void;
declare namespace markdownlint {
export { markdownlintSync as sync, readConfig, readConfigSync, getVersion, promises, applyFix, applyFixes, RuleFunction, RuleParams, MarkdownParsers, ParserMarkdownIt, ParserMicromark, MarkdownItToken, MicromarkTokenType, MicromarkToken, RuleOnError, RuleOnErrorInfo, RuleOnErrorFixInfo, RuleOnErrorFixInfoNormalized, Rule, Options, Plugin, ToStringCallback, LintResults, LintError, FixInfo, LintContentCallback, LintCallback, Configuration, ConfigurationStrict, RuleConfiguration, ConfigurationParser, ReadConfigCallback, ResolveConfigExtendsCallback };
}
export function lintAsync(options: Options | null, callback: LintCallback): void;
/**
* Lint specified Markdown files synchronously.
* Lint specified Markdown files.
*
* @param {Options | null} options Configuration options.
* @returns {Promise<LintResults>} Results object.
*/
export function lintPromise(options: Options | null): Promise<LintResults>;
/**
* Lint specified Markdown files.
*
* @param {Options | null} options Configuration options.
* @returns {LintResults} Results object.
*/
declare function markdownlintSync(options: Options | null): LintResults;
export function lintSync(options: Options | null): LintResults;
/**
* Extend specified configuration object.
*
* @param {Configuration} config Configuration object.
* @param {string} file Configuration file name.
* @param {ConfigurationParser[] | undefined} parsers Parsing function(s).
* @param {Object} fs File system implementation.
* @returns {Promise<Configuration>} Configuration object.
*/
export function extendConfigPromise(config: Configuration, file: string, parsers: ConfigurationParser[] | undefined, fs: any): Promise<Configuration>;
/**
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[] | ReadConfigCallback} parsers Parsing
* @param {ConfigurationParser[] | ReadConfigCallback} [parsers] Parsing
* function(s).
* @param {Object} [fs] File system implementation.
* @param {ReadConfigCallback} [callback] Callback (err, result) function.
* @returns {void}
*/
declare function readConfig(file: string, parsers: ConfigurationParser[] | ReadConfigCallback, fs?: any, callback?: ReadConfigCallback): void;
export function readConfigAsync(file: string, parsers?: ConfigurationParser[] | ReadConfigCallback, fs?: any, callback?: ReadConfigCallback): void;
/**
* Read specified configuration file synchronously.
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
* @param {Object} [fs] File system implementation.
* @returns {Promise<Configuration>} Configuration object.
*/
export function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: any): Promise<Configuration>;
/**
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
* @param {Object} [fs] File system implementation.
* @returns {Configuration} Configuration object.
* @throws An Error if processing fails.
*/
declare function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration;
/**
* Gets the (semantic) version of the library.
*
* @returns {string} SemVer string.
*/
declare function getVersion(): string;
declare namespace promises {
export { markdownlintPromise as markdownlint };
export { extendConfigPromise as extendConfig };
export { readConfigPromise as readConfig };
}
export function readConfigSync(file: string, parsers?: ConfigurationParser[], fs?: any): Configuration;
/**
* Applies the specified fix to a Markdown content line.
*
@ -57,7 +67,7 @@ declare namespace promises {
* @param {string} [lineEnding] Line ending to use.
* @returns {string | null} Fixed content or null if deleted.
*/
declare function applyFix(line: string, fixInfo: RuleOnErrorFixInfo, lineEnding?: string): string | null;
export function applyFix(line: string, fixInfo: RuleOnErrorFixInfo, lineEnding?: string): string | null;
/**
* Applies as many of the specified fixes as possible to Markdown content.
*
@ -65,15 +75,38 @@ declare function applyFix(line: string, fixInfo: RuleOnErrorFixInfo, lineEnding?
* @param {RuleOnErrorInfo[]} errors RuleOnErrorInfo instances.
* @returns {string} Fixed content.
*/
declare function applyFixes(input: string, errors: RuleOnErrorInfo[]): string;
export function applyFixes(input: string, errors: RuleOnErrorInfo[]): string;
/**
* Gets the (semantic) version of the library.
*
* @returns {string} SemVer string.
*/
export function getVersion(): string;
/**
* Result object for getEnabledRulesPerLineNumber.
*/
export type EnabledRulesPerLineNumberResult = {
/**
* Effective configuration.
*/
effectiveConfig: Configuration;
/**
* Enabled rules per line number.
*/
enabledRulesPerLineNumber: any[];
/**
* Enabled rule list.
*/
enabledRuleList: Rule[];
};
/**
* Function to implement rule logic.
*/
type RuleFunction = (params: RuleParams, onError: RuleOnError) => void;
export type RuleFunction = (params: RuleParams, onError: RuleOnError) => void;
/**
* Rule parameters.
*/
type RuleParams = {
export type RuleParams = {
/**
* File/string name.
*/
@ -102,7 +135,7 @@ type RuleParams = {
/**
* Markdown parser data.
*/
type MarkdownParsers = {
export type MarkdownParsers = {
/**
* Markdown parser data from markdown-it (only present when Rule.parser is "markdownit").
*/
@ -115,7 +148,7 @@ type MarkdownParsers = {
/**
* Markdown parser data from markdown-it.
*/
type ParserMarkdownIt = {
export type ParserMarkdownIt = {
/**
* Token objects from markdown-it.
*/
@ -124,7 +157,7 @@ type ParserMarkdownIt = {
/**
* Markdown parser data from micromark.
*/
type ParserMicromark = {
export type ParserMicromark = {
/**
* Token objects from micromark.
*/
@ -133,7 +166,7 @@ type ParserMicromark = {
/**
* markdown-it token.
*/
type MarkdownItToken = {
export type MarkdownItToken = {
/**
* HTML attributes.
*/
@ -195,11 +228,11 @@ type MarkdownItToken = {
*/
line: string;
};
type MicromarkTokenType = import("markdownlint-micromark").TokenType;
export type MicromarkTokenType = import("micromark-util-types").TokenType;
/**
* micromark token.
*/
type MicromarkToken = {
export type MicromarkToken = {
/**
* Token type.
*/
@ -236,11 +269,11 @@ type MicromarkToken = {
/**
* Error-reporting callback.
*/
type RuleOnError = (onErrorInfo: RuleOnErrorInfo) => void;
export type RuleOnError = (onErrorInfo: RuleOnErrorInfo) => void;
/**
* Fix information for RuleOnError callback.
*/
type RuleOnErrorInfo = {
export type RuleOnErrorInfo = {
/**
* Line number (1-based).
*/
@ -269,7 +302,7 @@ type RuleOnErrorInfo = {
/**
* Fix information for RuleOnErrorInfo.
*/
type RuleOnErrorFixInfo = {
export type RuleOnErrorFixInfo = {
/**
* Line number (1-based).
*/
@ -290,7 +323,7 @@ type RuleOnErrorFixInfo = {
/**
* RuleOnErrorInfo with all optional properties present.
*/
type RuleOnErrorFixInfoNormalized = {
export type RuleOnErrorFixInfoNormalized = {
/**
* Line number (1-based).
*/
@ -311,7 +344,7 @@ type RuleOnErrorFixInfoNormalized = {
/**
* Rule definition.
*/
type Rule = {
export type Rule = {
/**
* Rule name(s).
*/
@ -341,10 +374,27 @@ type Rule = {
*/
function: RuleFunction;
};
/**
* Method used by the markdown-it parser to parse input.
*/
export type MarkdownItParse = (src: string, env: any) => any[];
/**
* Instance of the markdown-it parser.
*/
export type MarkdownIt = {
/**
* Method to parse input.
*/
parse: MarkdownItParse;
};
/**
* Gets an instance of the markdown-it parser. Any plugins should already have been loaded.
*/
export type MarkdownItFactory = () => MarkdownIt | Promise<MarkdownIt>;
/**
* Configuration options.
*/
type Options = {
export type Options = {
/**
* Configuration object.
*/
@ -374,9 +424,9 @@ type Options = {
*/
handleRuleFailures?: boolean;
/**
* Additional plugins.
* Function to create a markdown-it parser.
*/
markdownItPlugins?: Plugin[];
markdownItFactory?: MarkdownItFactory;
/**
* True to ignore HTML directives.
*/
@ -395,21 +445,21 @@ type Options = {
/**
* A markdown-it plugin.
*/
type Plugin = any[];
export type Plugin = any[];
/**
* Function to pretty-print lint results.
*/
type ToStringCallback = (ruleAliases?: boolean) => string;
export type ToStringCallback = (ruleAliases?: boolean) => string;
/**
* Lint results (for resultVersion 3).
*/
type LintResults = {
export type LintResults = {
[x: string]: LintError[];
};
/**
* Lint error.
*/
type LintError = {
export type LintError = {
/**
* Line number (1-based).
*/
@ -446,7 +496,7 @@ type LintError = {
/**
* Fix information.
*/
type FixInfo = {
export type FixInfo = {
/**
* Line number (1-based).
*/
@ -467,60 +517,34 @@ type FixInfo = {
/**
* Called with the result of linting a string or document.
*/
type LintContentCallback = (error: Error | null, result?: LintError[]) => void;
export type LintContentCallback = (error: Error | null, result?: LintError[]) => void;
/**
* Called with the result of the lint function.
*/
type LintCallback = (error: Error | null, results?: LintResults) => void;
export type LintCallback = (error: Error | null, results?: LintResults) => void;
/**
* Configuration object for linting rules. For the JSON schema, see
* {@link ../schema/markdownlint-config-schema.json}.
*/
type Configuration = import("./configuration").Configuration;
export type Configuration = import("./configuration.d.ts").Configuration;
/**
* Configuration object for linting rules strictly. For the JSON schema, see
* {@link ../schema/markdownlint-config-schema-strict.json}.
*/
type ConfigurationStrict = import("./configuration-strict").ConfigurationStrict;
export type ConfigurationStrict = import("./configuration-strict.d.ts").ConfigurationStrict;
/**
* Rule configuration.
*/
type RuleConfiguration = boolean | any;
export type RuleConfiguration = boolean | any;
/**
* Parses a configuration string and returns a configuration object.
*/
type ConfigurationParser = (text: string) => Configuration;
export type ConfigurationParser = (text: string) => Configuration;
/**
* Called with the result of the readConfig function.
*/
type ReadConfigCallback = (err: Error | null, config?: Configuration) => void;
export type ReadConfigCallback = (err: Error | null, config?: Configuration) => void;
/**
* Called with the result of the resolveConfigExtends function.
*/
type ResolveConfigExtendsCallback = (err: Error | null, path?: string) => void;
/**
* Lint specified Markdown files.
*
* @param {Options} options Configuration options.
* @returns {Promise<LintResults>} Results object.
*/
declare function markdownlintPromise(options: Options): Promise<LintResults>;
/**
* Extend specified configuration object.
*
* @param {Configuration} config Configuration object.
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
* @param {Object} [fs] File system implementation.
* @returns {Promise<Configuration>} Configuration object.
*/
declare function extendConfigPromise(config: Configuration, file: string, parsers?: ConfigurationParser[], fs?: any): Promise<Configuration>;
/**
* Read specified configuration file.
*
* @param {string} file Configuration file name.
* @param {ConfigurationParser[]} [parsers] Parsing function(s).
* @param {Object} [fs] File system implementation.
* @returns {Promise<Configuration>} Configuration object.
*/
declare function readConfigPromise(file: string, parsers?: ConfigurationParser[], fs?: any): Promise<Configuration>;
export type ResolveConfigExtendsCallback = (err: Error | null, path?: string) => void;

File diff suppressed because it is too large Load diff

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getHeadingLevel } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorDetailIf } = require("../helpers");
const { getHeadingLevel } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD001", "heading-increment" ],
"description": "Heading levels should only increment by one level at a time",
"tags": [ "headings" ],

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getHeadingLevel, getHeadingStyle } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorDetailIf } = require("../helpers");
const { getHeadingLevel, getHeadingStyle } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD003", "heading-style" ],
"description": "Heading style",
"tags": [ "headings" ],

View file

@ -1,10 +1,8 @@
// @ts-check
"use strict";
const { addErrorDetailIf } = require("../helpers");
const { getDescendantsByType, getParentOfType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getDescendantsByType, getParentOfType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const markerToStyle = {
"-": "dash",
@ -29,9 +27,8 @@ const validStyles = new Set([
"sublist"
]);
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD004", "ul-style" ],
"description": "Unordered list style",
"tags": [ "bullet", "ul" ],
@ -43,7 +40,7 @@ module.exports = {
for (const listUnordered of filterByTypesCached([ "listUnordered" ])) {
let nesting = 0;
if (style === "sublist") {
/** @type {import("../helpers/micromark-helpers.cjs").Token | null} */
/** @type {import("markdownlint").MicromarkToken | null} */
let parent = listUnordered;
// @ts-ignore
while ((parent = getParentOfType(parent, [ "listOrdered", "listUnordered" ]))) {

View file

@ -1,13 +1,10 @@
// @ts-check
"use strict";
import { addError, addErrorDetailIf } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addError, addErrorDetailIf } = require("../helpers");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD005", "list-indent" ],
"description": "Inconsistent indentation for list items at the same level",
"tags": [ "bullet", "ul", "indentation" ],

View file

@ -1,23 +1,18 @@
// @ts-check
"use strict";
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getParentOfType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorDetailIf } = require("../helpers");
const { getParentOfType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("markdownlint-micromark").TokenType[] */
/** @type {import("micromark-util-types").TokenType[]} */
const unorderedListTypes =
[ "blockQuotePrefix", "listItemPrefix", "listUnordered" ];
// eslint-disable-next-line jsdoc/valid-types
/** @type import("markdownlint-micromark").TokenType[] */
/** @type {import("micromark-util-types").TokenType[]} */
const unorderedParentTypes =
[ "blockQuote", "listOrdered", "listUnordered" ];
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD007", "ul-indent" ],
"description": "Unordered list indentation",
"tags": [ "bullet", "ul", "indentation" ],
@ -35,7 +30,7 @@ module.exports = {
lastBlockQuotePrefix = token;
} else if (type === "listUnordered") {
let nesting = 0;
/** @type {import("../helpers/micromark-helpers.cjs").Token | null} */
/** @type {import("markdownlint").MicromarkToken | null} */
let current = token;
while (
// @ts-ignore

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addError } from "../helpers/helpers.cjs";
import { addRangeToSet } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addError } = require("../helpers");
const { addRangeToSet } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD009", "no-trailing-spaces" ],
"description": "Trailing spaces",
"tags": [ "whitespace" ],

View file

@ -1,16 +1,13 @@
// @ts-check
"use strict";
const { addError, hasOverlap } = require("../helpers");
const { getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addError, hasOverlap } from "../helpers/helpers.cjs";
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const tabRe = /\t+/g;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD010", "no-hard-tabs" ],
"description": "Hard tabs",
"tags": [ "whitespace", "hard_tab" ],
@ -26,8 +23,7 @@ module.exports = {
const spaceMultiplier = (spacesPerTab === undefined) ?
1 :
Math.max(0, Number(spacesPerTab));
// eslint-disable-next-line jsdoc/valid-types
/** @type import("../helpers/micromark-helpers.cjs").TokenType[] */
/** @type {import("markdownlint").MicromarkTokenType[]} */
const exclusionTypes = [];
if (includeCode) {
if (ignoreCodeLanguages.size > 0) {
@ -60,7 +56,7 @@ module.exports = {
const lineNumber = lineIndex + 1;
const column = match.index + 1;
const length = match[0].length;
/** @type {import("../helpers").FileRange} */
/** @type {import("../helpers/helpers.cjs").FileRange} */
const range = { "startLine": lineNumber, "startColumn": column, "endLine": lineNumber, "endColumn": column + length - 1 };
if (!codeRanges.some((codeRange) => hasOverlap(codeRange, range))) {
addError(

View file

@ -1,17 +1,13 @@
// @ts-check
"use strict";
import { addError, hasOverlap } from "../helpers/helpers.cjs";
import { addRangeToSet } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addError, hasOverlap } = require("../helpers");
const { addRangeToSet } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
const reversedLinkRe = /(^|[^\\])\(([^()]+)\)\[([^\]^][^\]]*)\](?!\()/g;
const reversedLinkRe =
/(^|[^\\])\(([^()]+)\)\[([^\]^][^\]]*)\](?!\()/g;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD011", "no-reversed-links" ],
"description": "Reversed link syntax",
"tags": [ "links" ],
@ -34,7 +30,7 @@ module.exports = {
) {
const column = match.index + preChar.length + 1;
const length = match[0].length - preChar.length;
/** @type {import("../helpers").FileRange} */
/** @type {import("../helpers/helpers.cjs").FileRange} */
const range = { "startLine": lineNumber, "startColumn": column, "endLine": lineNumber, "endColumn": column + length - 1 };
if (!codeTexts.some((codeText) => hasOverlap(codeText, range))) {
addError(

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { addRangeToSet } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorDetailIf } = require("../helpers");
const { addRangeToSet } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD012", "no-multiple-blanks" ],
"description": "Multiple consecutive blank lines",
"tags": [ "whitespace", "blank_lines" ],

View file

@ -1,20 +1,19 @@
// @ts-check
"use strict";
const { addErrorDetailIf } = require("../helpers");
const { getReferenceLinkImageData } = require("./cache");
const { addRangeToSet, getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { filterByTypesCached, getReferenceLinkImageData } from "./cache.mjs";
import { addRangeToSet, getDescendantsByType } from "../helpers/micromark-helpers.cjs";
const longLineRePrefix = "^.{";
const longLineRePostfixRelaxed = "}.*\\s.*$";
const longLineRePostfixStrict = "}.+$";
const sternModeRe = /^(?:[#>\s]*\s)?\S*$/;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @typedef {import("micromark-extension-gfm-autolink-literal")} */
/** @typedef {import("micromark-extension-gfm-table")} */
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD013", "line-length" ],
"description": "Line length",
"tags": [ "line_length" ],

View file

@ -1,15 +1,12 @@
// @ts-check
"use strict";
const { addErrorContext } = require("../helpers");
const { filterByTypesCached } = require("./cache");
import { addErrorContext } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const dollarCommandRe = /^(\s*)(\$\s+)/;
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD014", "commands-show-output" ],
"description": "Dollar signs used before commands without showing output",
"tags": [ "code" ],

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addErrorContext } from "../helpers/helpers.cjs";
import { addRangeToSet } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorContext } = require("../helpers");
const { addRangeToSet } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD018", "no-missing-space-atx" ],
"description": "No space after hash on atx style heading",
"tags": [ "headings", "atx", "spaces" ],

View file

@ -1,16 +1,14 @@
// @ts-check
"use strict";
const { addErrorContext } = require("../helpers/helpers");
const { getHeadingStyle } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorContext } from "../helpers/helpers.cjs";
import { getHeadingStyle } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
/**
* Validate heading sequence and whitespace length at start or end.
*
* @param {import("./markdownlint").RuleOnError} onError Error-reporting callback.
* @param {import("./markdownlint").MicromarkToken} heading ATX heading token.
* @param {import("markdownlint").RuleOnError} onError Error-reporting callback.
* @param {import("markdownlint").MicromarkToken} heading ATX heading token.
* @param {number} delta Direction to scan.
* @returns {void}
*/
@ -47,9 +45,8 @@ function validateHeadingSpaces(onError, heading, delta) {
}
}
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule[] */
module.exports = [
/** @type {import("markdownlint").Rule[]} */
export default [
{
"names": [ "MD019", "no-multiple-space-atx" ],
"description": "Multiple spaces after hash on atx style heading",

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addErrorContext } from "../helpers/helpers.cjs";
import { addRangeToSet } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorContext } = require("../helpers");
const { addRangeToSet } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD020", "no-missing-space-closed-atx" ],
"description": "No space inside hashes on closed atx style heading",
"tags": [ "headings", "atx_closed", "spaces" ],

View file

@ -1,10 +1,8 @@
// @ts-check
"use strict";
const { addErrorDetailIf, isBlankLine } = require("../helpers");
const { getBlockQuotePrefixText, getHeadingLevel } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf, isBlankLine } from "../helpers/helpers.cjs";
import { getBlockQuotePrefixText, getHeadingLevel } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const defaultLines = 1;
@ -21,9 +19,8 @@ const getLinesFunction = (linesParam) => {
return () => lines;
};
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD022", "blanks-around-headings" ],
"description": "Headings should be surrounded by blank lines",
"tags": [ "headings", "blank_lines" ],

View file

@ -1,13 +1,10 @@
// @ts-check
"use strict";
import { addErrorContext } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorContext } = require("../helpers");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD023", "heading-start-left" ],
"description": "Headings must start at the beginning of the line",
"tags": [ "headings", "spaces" ],

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addErrorContext } from "../helpers/helpers.cjs";
import { getHeadingLevel, getHeadingText } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorContext } = require("../helpers");
const { getHeadingLevel, getHeadingText } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD024", "no-duplicate-heading" ],
"description": "Multiple headings with the same content",
"tags": [ "headings" ],

View file

@ -1,40 +0,0 @@
// @ts-check
"use strict";
const { addErrorContext, frontMatterHasTitle } = require("../helpers");
const { getHeadingLevel, getHeadingText } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
"names": [ "MD025", "single-title", "single-h1" ],
"description": "Multiple top-level headings in the same document",
"tags": [ "headings" ],
"parser": "micromark",
"function": function MD025(params, onError) {
const level = Number(params.config.level || 1);
const foundFrontMatterTitle =
frontMatterHasTitle(
params.frontMatterLines,
params.config.front_matter_title
);
let hasTopLevelHeading = false;
for (const heading of filterByTypesCached([ "atxHeading", "setextHeading" ])) {
const headingLevel = getHeadingLevel(heading);
if (headingLevel === level) {
if (hasTopLevelHeading || foundFrontMatterTitle) {
const headingText = getHeadingText(heading);
addErrorContext(
onError,
heading.startLine,
headingText
);
} else if (heading.startLine === 1) {
hasTopLevelHeading = true;
}
}
}
}
};

45
lib/md025.mjs Normal file
View file

@ -0,0 +1,45 @@
// @ts-check
import { addErrorContext, frontMatterHasTitle } from "../helpers/helpers.cjs";
import { getHeadingLevel, getHeadingText, isDocfxTab, isHtmlFlowComment, nonContentTokens } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD025", "single-title", "single-h1" ],
"description": "Multiple top-level headings in the same document",
"tags": [ "headings" ],
"parser": "micromark",
"function": function MD025(params, onError) {
const level = Number(params.config.level || 1);
const { tokens } = params.parsers.micromark;
const matchingHeadings = filterByTypesCached([ "atxHeading", "setextHeading" ])
.filter((heading) => (level === getHeadingLevel(heading)) && !isDocfxTab(heading));
if (matchingHeadings.length > 0) {
const foundFrontMatterTitle =
frontMatterHasTitle(
params.frontMatterLines,
params.config.front_matter_title
);
// Front matter title counts as a top-level heading if present
let hasTopLevelHeading = foundFrontMatterTitle;
if (!hasTopLevelHeading) {
// Check if the first matching heading is a top-level heading
const previousTokens = tokens.slice(0, tokens.indexOf(matchingHeadings[0]));
hasTopLevelHeading = previousTokens.every(
(token) => nonContentTokens.has(token.type) || isHtmlFlowComment(token)
);
}
if (hasTopLevelHeading) {
// All other matching headings are violations
for (const heading of matchingHeadings.slice(foundFrontMatterTitle ? 0 : 1)) {
addErrorContext(
onError,
heading.startLine,
getHeadingText(heading)
);
}
}
}
}
};

View file

@ -1,14 +1,11 @@
// @ts-check
"use strict";
import { addError, allPunctuationNoQuestion, endOfLineGemojiCodeRe,
endOfLineHtmlEntityRe, escapeForRegExp } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addError, allPunctuationNoQuestion, endOfLineGemojiCodeRe,
endOfLineHtmlEntityRe, escapeForRegExp } = require("../helpers");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD026", "no-trailing-punctuation" ],
"description": "Trailing punctuation in heading",
"tags": [ "headings" ],

View file

@ -1,37 +0,0 @@
// @ts-check
"use strict";
const { addErrorContext } = require("../helpers");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
"names": [ "MD027", "no-multiple-space-blockquote" ],
"description": "Multiple spaces after blockquote symbol",
"tags": [ "blockquote", "whitespace", "indentation" ],
"parser": "micromark",
"function": function MD027(params, onError) {
for (const token of filterByTypesCached([ "linePrefix" ])) {
const siblings = token.parent?.children || params.parsers.micromark.tokens;
if (siblings[siblings.indexOf(token) - 1]?.type === "blockQuotePrefix") {
const { startColumn, startLine, text } = token;
const { length } = text;
const line = params.lines[startLine - 1];
addErrorContext(
onError,
startLine,
line,
undefined,
undefined,
[ startColumn, length ],
{
"editColumn": startColumn,
"deleteCount": length
}
);
}
}
}
};

50
lib/md027.mjs Normal file
View file

@ -0,0 +1,50 @@
// @ts-check
import { addErrorContext } from "../helpers/helpers.cjs";
import { getParentOfType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
/** @type {import("../helpers/micromark-helpers.cjs").TokenType[]} */
const listTypes = [ "listOrdered", "listUnordered" ];
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD027", "no-multiple-space-blockquote" ],
"description": "Multiple spaces after blockquote symbol",
"tags": [ "blockquote", "whitespace", "indentation" ],
"parser": "micromark",
"function": function MD027(params, onError) {
const listItems = params.config.list_items;
const includeListItems = (listItems === undefined) ? true : !!listItems;
const { tokens } = params.parsers.micromark;
for (const token of filterByTypesCached([ "linePrefix" ])) {
const parent = token.parent;
const codeIndented = parent?.type === "codeIndented";
const siblings = parent?.children || tokens;
if (
!codeIndented &&
(siblings[siblings.indexOf(token) - 1]?.type === "blockQuotePrefix") &&
(includeListItems || (
!listTypes.includes(siblings[siblings.indexOf(token) + 1]?.type) &&
!getParentOfType(token, listTypes)
))
) {
const { startColumn, startLine, text } = token;
const { length } = text;
const line = params.lines[startLine - 1];
addErrorContext(
onError,
startLine,
line,
undefined,
undefined,
[ startColumn, length ],
{
"editColumn": startColumn,
"deleteCount": length
}
);
}
}
}
};

View file

@ -1,15 +1,12 @@
// @ts-check
"use strict";
const { addError } = require("../helpers");
const { filterByTypesCached } = require("./cache");
import { addError } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const ignoreTypes = new Set([ "lineEnding", "listItemIndent", "linePrefix" ]);
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD028", "no-blanks-blockquote" ],
"description": "Blank line inside blockquote",
"tags": [ "blockquote", "whitespace" ],

View file

@ -1,10 +1,8 @@
// @ts-check
"use strict";
const { addErrorDetailIf } = require("../helpers");
const { getDescendantsByType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { getDescendantsByType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const listStyleExamples = {
"one": "1/1/1",
@ -15,16 +13,15 @@ const listStyleExamples = {
/**
* Gets the value of an ordered list item prefix token.
*
* @param {import("../helpers/micromark-helpers.cjs").Token} listItemPrefix List item prefix token.
* @param {import("markdownlint").MicromarkToken} listItemPrefix List item prefix token.
* @returns {number} List item value.
*/
function getOrderedListItemValue(listItemPrefix) {
return Number(getDescendantsByType(listItemPrefix, [ "listItemValue" ])[0].text);
}
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD029", "ol-prefix" ],
"description": "Ordered list item prefix",
"tags": [ "ol" ],

View file

@ -1,13 +1,10 @@
// @ts-check
"use strict";
import { addErrorDetailIf } from "../helpers/helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const { addErrorDetailIf } = require("../helpers");
const { filterByTypesCached } = require("./cache");
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD030", "list-marker-space" ],
"description": "Spaces after list markers",
"tags": [ "ol", "ul", "whitespace" ],

View file

@ -1,10 +1,8 @@
// @ts-check
"use strict";
const { addErrorContext, isBlankLine } = require("../helpers");
const { getParentOfType } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorContext, isBlankLine } from "../helpers/helpers.cjs";
import { getParentOfType } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const codeFencePrefixRe = /^(.*?)[`~]/;
@ -14,7 +12,7 @@ const codeFencePrefixRe = /^(.*?)[`~]/;
/**
* Adds an error for the top or bottom of a code fence.
*
* @param {import("./markdownlint").RuleOnError} onError Error-reporting callback.
* @param {import("markdownlint").RuleOnError} onError Error-reporting callback.
* @param {ReadonlyStringArray} lines Lines of Markdown content.
* @param {number} lineNumber Line number.
* @param {boolean} top True iff top fence.
@ -24,7 +22,7 @@ function addError(onError, lines, lineNumber, top) {
const line = lines[lineNumber - 1];
const [ , prefix ] = line.match(codeFencePrefixRe) || [];
const fixInfo = (prefix === undefined) ?
null :
undefined :
{
"lineNumber": lineNumber + (top ? 0 : 1),
"insertText": `${prefix.replace(/[^>]/g, " ").trim()}\n`
@ -40,9 +38,8 @@ function addError(onError, lines, lineNumber, top) {
);
}
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD031", "blanks-around-fences" ],
"description": "Fenced code blocks should be surrounded by blank lines",
"tags": [ "code", "blank_lines" ],

View file

@ -1,18 +1,15 @@
// @ts-check
"use strict";
const { addErrorContext, isBlankLine } = require("../helpers");
const { filterByPredicate, getBlockQuotePrefixText, nonContentTokens } = require("../helpers/micromark-helpers.cjs");
const { filterByTypesCached } = require("./cache");
import { addErrorContext, isBlankLine } from "../helpers/helpers.cjs";
import { filterByPredicate, getBlockQuotePrefixText, nonContentTokens } from "../helpers/micromark-helpers.cjs";
import { filterByTypesCached } from "./cache.mjs";
const isList = (token) => (
(token.type === "listOrdered") || (token.type === "listUnordered")
);
// eslint-disable-next-line jsdoc/valid-types
/** @type import("./markdownlint").Rule */
module.exports = {
/** @type {import("markdownlint").Rule} */
export default {
"names": [ "MD032", "blanks-around-lists" ],
"description": "Lists should be surrounded by blank lines",
"tags": [ "bullet", "ul", "ol", "blank_lines" ],
@ -48,13 +45,14 @@ module.exports = {
}
// Find the "visual" end of the list
const flattenedChildren = filterByPredicate(
list.children,
(token) => !nonContentTokens.has(token.type),
(token) => nonContentTokens.has(token.type) ? [] : token.children
);
let endLine = list.endLine;
const flattenedChildren = filterByPredicate(list.children);
for (const child of flattenedChildren.reverse()) {
if (!nonContentTokens.has(child.type)) {
endLine = child.endLine;
break;
}
if (flattenedChildren.length > 0) {
endLine = flattenedChildren[flattenedChildren.length - 1].endLine;
}
// Look for a blank line below the list

Some files were not shown because too many files have changed in this diff Show more