mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Enable, validate, and demonstrate the use of built-in style definitions (fixes #593).
This commit is contained in:
parent
eb05bac07d
commit
c383aab383
3 changed files with 21 additions and 4 deletions
10
README.md
10
README.md
|
@ -354,7 +354,7 @@ configuration object with all properties set to the default value.
|
|||
Sets of rules (known as a "style") can be stored separately and loaded
|
||||
as [JSON](https://en.wikipedia.org/wiki/JSON).
|
||||
|
||||
Example:
|
||||
Example of referencing a built-in style from JavaScript:
|
||||
|
||||
```js
|
||||
const options = {
|
||||
|
@ -363,6 +363,14 @@ const options = {
|
|||
};
|
||||
```
|
||||
|
||||
Example doing so from `.markdownlint.json` via `extends` (more on this below):
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": "markdownlint/style/relaxed"
|
||||
}
|
||||
```
|
||||
|
||||
See the [style](style) directory for more samples.
|
||||
|
||||
See [markdownlint-config-schema.json](schema/markdownlint-config-schema.json)
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
"main": "./lib/markdownlint.js",
|
||||
"exports": {
|
||||
".": "./lib/markdownlint.js",
|
||||
"./helpers": "./helpers/helpers.js"
|
||||
"./helpers": "./helpers/helpers.js",
|
||||
"./style/all": "./style/all.json",
|
||||
"./style/cirosantilli": "./style/cirosantilli.json",
|
||||
"./style/relaxed": "./style/relaxed.json"
|
||||
},
|
||||
"types": "./lib/markdownlint.d.ts",
|
||||
"author": "David Anson (https://dlaa.me/)",
|
||||
|
|
|
@ -12,7 +12,8 @@ const pluginSup = require("markdown-it-sup");
|
|||
const pluginTexMath = require("markdown-it-texmath");
|
||||
const test = require("ava").default;
|
||||
const tv4 = require("tv4");
|
||||
const { homepage, version } = require("../package.json");
|
||||
const { "exports": packageExports, homepage, version } =
|
||||
require("../package.json");
|
||||
const markdownlint = require("../lib/markdownlint");
|
||||
const constants = require("../lib/constants");
|
||||
const rules = require("../lib/rules");
|
||||
|
@ -430,11 +431,14 @@ test("enableTagMixedCase", (t) => new Promise((resolve) => {
|
|||
}));
|
||||
|
||||
test("styleFiles", (t) => new Promise((resolve) => {
|
||||
t.plan(4);
|
||||
t.plan(7);
|
||||
fs.readdir("./style", function readdir(err, files) {
|
||||
t.falsy(err);
|
||||
for (const file of files) {
|
||||
t.truthy(require(path.join("../style", file)), "Unable to load/parse.");
|
||||
const exportValue = `./style/${file}`;
|
||||
const exportKey = exportValue.replace(/\.json$/, "");
|
||||
t.is(packageExports[exportKey], exportValue);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
|
@ -1402,6 +1406,8 @@ test("getVersion", (t) => {
|
|||
|
||||
test("constants", (t) => {
|
||||
t.plan(2);
|
||||
// @ts-ignore
|
||||
t.is(constants.homepage, homepage);
|
||||
// @ts-ignore
|
||||
t.is(constants.version, version);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue