1

I'm using the linter-markdown package in Atom for writing tidy Markdown.

Generally I prefer having the package option Strict markdown style by default active. It adds the rule preset remark-preset-lint-markdown-style-guide based on Ciro Santilli's Markdown Style Guide to the checks.

But sometimes, for example when working with Slate, external factors force me to break one or two of the strict Markdown Style Guide rules.

For those cases I would like to be able to manually deactivate those rules, but only for the particular project.

linter-markdown uses remark-lint which supports a .remarkrc configuration file.

If I put a .remarkrc file with the following content in the same directory as the Markdown file in question, it definitely does get picked up. But the linter then fails with a fatal error, also shown below.

.remarkrc:

{
  "plugins": [
    "remark-preset-lint-markdown-style-guide",
    ["no-multiple-toplevel-headings", false]
  ]
}

Error:

Error: Could not find module `remark-preset-lint-markdown-style-guide`...

Does anyone know of a good way to customize the linter rules for the linter-markdown Atom package on a per project basis?

ScottWelker
  • 1,701
  • 17
  • 30
anothernode
  • 5,100
  • 13
  • 43
  • 62
  • You might have better luck opening an issue on GitHub (at https://github.com/remarkjs/remark-lint). – dlu Jun 17 '18 at 15:34

2 Answers2

1

I ran in to the same problem, placing the .remarkrc file in my home directory. It seems like either:

  • That snippet of code, from the remarkjs/remark-lint page on GitHub, so you would think that it is right, doesn't include the configuration needed to find the base file (remark-preset-lint-recommended), or
  • The base file has been removed or renamed.

In either case removing the reference to the base file so that the snippet reads:

{
  "plugins": [
    ["remark-lint-list-item-indent", false]
  ]
}

got around my immediate problem - I no longer have every list item flagged. I'm guessing that linter-markdown has a set of defaults that it is pulling from somewhere -- presumably based on the Settings checkboxes.

EDIT: after a bit more poking around I found a reference on the NPM page for installing the base file. Following those instructions also makes the error go away, but not in a very tidy way -- the package is installed in the current directory. I, somewhat, resolved this by installing in my home directory, but that's a kludge. It does get found there. Clearly there is more to understand here as it seems that linter-markdown uses a different method for setting defaults.

dlu
  • 749
  • 10
  • 27
0

I have this configuration in the root of my markdown project, and it seems to be working right:

{
  "plugins": [
    "remark-lint"
  ],
  "settings": {
    "commonmark": true,
    "blockquote-indentation": "2",
    "checkbox-character-style": {
      "checked": "x",
      "unchecked": " "
    },
    "code-block-style": "fenced",
    "heading-style": "atx",
    "list-item-spacing": false,
    "no-html": false,
    "no-shortcut-reference-link": true,
    "no-undefined-references": true,
    "ordered-list-marker-value": "ordered",
    "rule-style": "---",
    "unordered-list-marker-style": "-",
    "maximum-line-length": "120"
  }
}
flags
  • 461
  • 5
  • 11