diff --git a/packages/remark-preset-lint-consistent/readme.md b/packages/remark-preset-lint-consistent/readme.md index aecc50e1..d24162fa 100644 --- a/packages/remark-preset-lint-consistent/readme.md +++ b/packages/remark-preset-lint-consistent/readme.md @@ -17,6 +17,7 @@ Preset of [`remark-lint`][mono] rules to warn for inconsistencies. * [What is this?](#what-is-this) * [When should I use this?](#when-should-i-use-this) * [Rules](#rules) +* [Settings](#settings) * [Install](#install) * [Use](#use) * [API](#api) @@ -54,6 +55,10 @@ This preset configures [`remark-lint`][mono] with the following rules: | [`remark-lint-strong-marker`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-strong-marker) | `'consistent'` | | [`remark-lint-table-cell-padding`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-table-cell-padding) | `'consistent'` | +## Settings + +It doesn't set any remark [settings][configure]. + ## Install This package is [ESM only][esm]. @@ -183,6 +188,8 @@ abide by its terms. [mono]: https://github.com/remarkjs/remark-lint +[configure]: https://github.com/remarkjs/remark-lint#configure + [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c [skypack]: https://www.skypack.dev diff --git a/packages/remark-preset-lint-markdown-style-guide/readme.md b/packages/remark-preset-lint-markdown-style-guide/readme.md index bf0751e4..3649b22f 100644 --- a/packages/remark-preset-lint-markdown-style-guide/readme.md +++ b/packages/remark-preset-lint-markdown-style-guide/readme.md @@ -17,6 +17,7 @@ Preset of [`remark-lint`][mono] rules that follow an opinionated style guide. * [What is this?](#what-is-this) * [When should I use this?](#when-should-i-use-this) * [Rules](#rules) +* [Settings](#settings) * [Install](#install) * [Use](#use) * [API](#api) @@ -175,6 +176,25 @@ This preset configures [`remark-lint`][mono] with the following rules: | [`remark-lint-no-emphasis-as-heading`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-emphasis-as-heading) | | | [`remark-lint-no-literal-urls`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-literal-urls) | | +## Settings + +It sets the following remark [settings][configure]. +Settings are shared among all plugins --- particularly [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#options): + +| Name | Value | +| - | - | +| `settings.bullet` | `'-'` | +| `settings.bulletOrdered` | `'.'` | +| `settings.emphasis` | `'*'` | +| `settings.fence` | ``'`'`` | +| `settings.fences` | `true` | +| `settings.incrementListMarker` | `false` | +| `settings.listItemIndent` | `'mixed'` | +| `settings.quote` | `'"'` | +| `settings.rule` | `'-'` | +| `settings.setext` | `false` | +| `settings.strong` | `'*'` | + ## Install This package is [ESM only][esm]. @@ -304,6 +324,8 @@ abide by its terms. [mono]: https://github.com/remarkjs/remark-lint +[configure]: https://github.com/remarkjs/remark-lint#configure + [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c [skypack]: https://www.skypack.dev diff --git a/packages/remark-preset-lint-recommended/readme.md b/packages/remark-preset-lint-recommended/readme.md index f0c46678..1ebb562a 100644 --- a/packages/remark-preset-lint-recommended/readme.md +++ b/packages/remark-preset-lint-recommended/readme.md @@ -17,6 +17,7 @@ Preset of [`remark-lint`][mono] rules to warn for some likely problems. * [What is this?](#what-is-this) * [When should I use this?](#when-should-i-use-this) * [Rules](#rules) +* [Settings](#settings) * [Install](#install) * [Use](#use) * [API](#api) @@ -56,6 +57,16 @@ This preset configures [`remark-lint`][mono] with the following rules: | [`remark-lint-no-undefined-references`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-undefined-references) | | | [`remark-lint-no-unused-definitions`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-lint-no-unused-definitions) | | +## Settings + +It sets the following remark [settings][configure]. +Settings are shared among all plugins --- particularly [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#options): + +| Name | Value | +| - | - | +| `settings.bulletOrdered` | `'.'` | +| `settings.listItemIndent` | `'tab'` | + ## Install This package is [ESM only][esm]. @@ -185,6 +196,8 @@ abide by its terms. [mono]: https://github.com/remarkjs/remark-lint +[configure]: https://github.com/remarkjs/remark-lint#configure + [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c [skypack]: https://www.skypack.dev diff --git a/script/build-presets.js b/script/build-presets.js index 46e815d0..17454da7 100644 --- a/script/build-presets.js +++ b/script/build-presets.js @@ -29,7 +29,7 @@ presets(root).then((presetObjects) => { let index = -1 while (++index < presetObjects.length) { - const {name, packages} = presetObjects[index] + const {name, packages, settings} = presetObjects[index] const base = path.resolve(root, name) /** @type {PackageJson} */ const pack = JSON.parse( @@ -311,6 +311,89 @@ presets(root).then((presetObjects) => { ] }, {type: 'table', align: [], children: rows}, + { + type: 'heading', + depth: 2, + children: [{type: 'text', value: 'Settings'}] + }, + .../** @type {Array} */ ( + settings + ? [ + { + type: 'paragraph', + children: [ + {type: 'text', value: 'It sets the following remark '}, + { + type: 'linkReference', + identifier: 'configure', + referenceType: 'full', + children: [{type: 'text', value: 'settings'}] + }, + { + type: 'text', + value: + '.\nSettings are shared among all plugins --- particularly ' + }, + { + type: 'link', + url: 'https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#options', + title: null, + children: [{type: 'inlineCode', value: 'remark-stringify'}] + }, + {type: 'text', value: ':'} + ] + }, + { + type: 'table', + align: [], + children: [ + { + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [{type: 'text', value: 'Name'}] + }, + { + type: 'tableCell', + children: [{type: 'text', value: 'Value'}] + } + ] + }, + ...Object.entries(settings).map(([name, value]) => ({ + type: 'tableRow', + children: [ + { + type: 'tableCell', + children: [ + {type: 'inlineCode', value: `settings.${name}`} + ] + }, + { + type: 'tableCell', + children: [{type: 'inlineCode', value: inspect(value)}] + } + ] + })) + ] + } + ] + : [ + { + type: 'paragraph', + children: [ + {type: 'text', value: "It doesn't set any remark "}, + { + type: 'linkReference', + identifier: 'configure', + referenceType: 'full', + children: [{type: 'text', value: 'settings'}] + }, + {type: 'text', value: '.'} + ] + } + ] + ), { type: 'heading', depth: 2, @@ -664,6 +747,11 @@ presets(root).then((presetObjects) => { identifier: 'mono', url: 'https://github.com/' + slug }, + { + type: 'definition', + identifier: 'configure', + url: `https://github.com/${slug}#configure` + }, { type: 'definition', identifier: 'esm', diff --git a/script/util/presets.js b/script/util/presets.js index 64795492..8a6fd005 100644 --- a/script/util/presets.js +++ b/script/util/presets.js @@ -9,7 +9,7 @@ import url from 'node:url' /** * @param {string} base - * @returns {Promise}>>} + * @returns {Promise, settings: Record|undefined}>>} */ export async function presets(base) { const allFiles = await fs.readdir(base) @@ -70,7 +70,7 @@ export async function presets(base) { ] = option } - return {name, packages} + return {name, packages, settings: preset.settings} }) ) }