Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .markdownlint-cli2.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import markdownIt from "markdown-it";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add this to the package.json?

import { init } from "./index.js";

const markdownItFactory = () => markdownIt({ html: true });

const configOptions = await init({
default: false,
"heading-increment": true,
Expand All @@ -11,5 +14,6 @@ const configOptions = await init({
const options = {
config: configOptions,
customRules: ["./index.js"],
markdownItFactory,
};
export default options;
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali
4. Edit `.markdownlint-cli2.mjs` file to suit your needs. Start with

```js
import markdownIt from "markdown-it"
import configOptions, {init} from "@github/markdownlint-github"
const markdownItFactory = () => markdownIt({ html: true })
const options = {
config: init(),
customRules: ["@github/markdownlint-github"],
markdownItFactory,
outputFormatters: [
[ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation
]
Expand All @@ -62,13 +65,16 @@ See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--ali
This looks like:

```js
import markdownIt from "markdown-it"
import configOptions, {init} from "@github/markdownlint-github"
const overriddenOptions = init({
'fenced-code-language': false, // Custom overrides
})
const markdownItFactory = () => markdownIt({ html: true })
const options = {
config: overriddenOptions,
customRules: ["@github/markdownlint-github"],
markdownItFactory,
outputFormatters: [
[ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ]
]
Expand Down Expand Up @@ -96,9 +102,12 @@ The rule will need to be enabled in the configuration. For instance, if you intr

```js
import configOptions, {init} from "@github/markdownlint-github"
import markdownIt from "markdown-it"
const markdownItFactory = () => markdownIt({ html: true })
const options = init({
"some-rule": true,
customRules: ["@github/markdownlint-github", "some-rule.js"],
markdownItFactory
})
export default options
```
Expand Down
Loading