Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remark not picking up configuration #187

Closed
areohbe opened this issue Oct 10, 2018 · 7 comments
Closed

Remark not picking up configuration #187

areohbe opened this issue Oct 10, 2018 · 7 comments
Labels
🙋 no/question This does not need any changes

Comments

@areohbe
Copy link

areohbe commented Oct 10, 2018

I thought #165 might have the answer but this seems limited to global installs.

My project setup is:

package.json

{
  "scripts": {
    ...
    "lint-md": "remark ../docs/getting-started.md"
  },
  "devDependencies": {
    ...
    "remark-cli": "^5.0.0",
    "remark-lint": "^6.0.2",
    "remark-preset-lint-recommended": "^3.0.2",
    ...
  },
...
}

.remarkrc

{
  "plugins": [
    "remark-preset-lint-recommended"
  ]
}

When I run lint-md it doesn't look like my .remarkrc is getting picked up. I also tried configuring it directly in package.json but same result.

Debug Log

@wooorm
Copy link
Member

wooorm commented Oct 11, 2018

@areohbe Correct, remark picks up configuration files from the file and up, but your package.json and .remarkrc are in a different path.
The solution is to place them both one level up, or place the docs inside a directory with a .remarkrc file!

@areohbe
Copy link
Author

areohbe commented Oct 11, 2018

@wooorm thanks! Moving the .remarkc to docs folder returns error. I am guessing because now it's in a different directory than package.json and can't locate the plugin inside npm_modules.

Is there any way to handle this? Or do package.jsonand .remarkc both need to me to be inside the same top level directory as my content?

@wooorm
Copy link
Member

wooorm commented Oct 11, 2018

The remarkrc needs to be in the directory of a file, or in a directory higher.
The remarkc file references plugins by path, similar to how nodes require works, so you can do '../some-path/node_modules/some- plugin' as well!

@areohbe
Copy link
Author

areohbe commented Oct 11, 2018

Moved some things around but still no errors returned.

Now my project looks like:

project/
├── website/
│   ├── package.json
│   └── node-modules/
└── docs/
    ├── .remarkrc
    ├── root.md
    └── bar/
        ├── bar1.md
        └── bar2.md

and my .remarkrc looks like:

{
  "plugins": [
    "../website/node_modules/remark-preset-lint-recommended"
  ]
}

@Murderlon
Copy link
Member

If you separate docs from your site, you might want to split the logic as well.
Perhaps create a new package.json with the remark packages and lint-md script.

project/
├── website/
│   ├── package.json
│   └── node-modules/
└── docs/
    ├── package.json
    ├── node-modules/
    ├── .remarkrc
    ├── root.md
    └── bar/
        ├── bar1.md
        └── bar2.md

The above should work.

@areohbe
Copy link
Author

areohbe commented Oct 11, 2018

Thanks @Murderlon - this is what I ended up doing. In hindsight, I like this approach. I can keep all content related modules inside /docs and all the app modules inside /website.

@areohbe areohbe closed this as completed Oct 11, 2018
@wooorm wooorm added the 🙋 no/question This does not need any changes label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes
Development

No branches or pull requests

4 participants
@areohbe @wooorm @Murderlon and others