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

Document path globs support #120

Closed
ghost opened this issue Jan 3, 2016 · 13 comments
Closed

Document path globs support #120

ghost opened this issue Jan 3, 2016 · 13 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 3, 2016

Hello,
I'd like to ask you to implement support for specifying input files by globs. That would allow us to run remark from build (e.g. npm) scripts in a portable (cross-platform) way. There is actually a lot of linters that accept globs already. They use minimatch AFAIK. I mean some module based on it like globby, glob-all, globule or simple-glob.

@wooorm
Copy link
Member

wooorm commented Jan 3, 2016

Remark has support for globs, and uses minimatch, globby, internally. Could you show me a test case which doesn’t work?

@ghost
Copy link
Author

ghost commented Jan 3, 2016

Sure, let me change this issue to a request to document the support. I'll create another report for the issue.

@ghost ghost changed the title Path globs support Document path globs support Jan 3, 2016
@wooorm
Copy link
Member

wooorm commented Jan 3, 2016

Thanks for the issue. I’m not sure what kind of documentation you expect though. There are already some examples of . usage in https://github.com/wooorm/remark#cli and https://github.com/wooorm/remark/blob/master/doc/remark.1.md. What do you suggest?

@ghost
Copy link
Author

ghost commented Jan 3, 2016

AFAIK, . is not a glob. Or at least it's not a wildcard. Or in other words, the path . can be handled without any support of globs and thus it's hard to deduce whether globs are supported or not.

Anyway, ideally, you could mention the supported glob syntax (at least something like this: https://www.npmjs.com/package/globby#globbing-patterns). But if it's too much, adding an example with * could be enough.

@wooorm wooorm closed this as completed in f9f9a36 Jan 3, 2016
@ghost
Copy link
Author

ghost commented Jan 3, 2016

Cool, thanks

@wooorm wooorm added 🐛 type/bug This is a problem remark-cli labels Jan 10, 2016
@davidtheclark
Copy link
Contributor

@wooorm Does this module still use globby internally? I can't find usage of it in this repo or in unified-args. And I'm struggling to figure out how to pass globs with negation (!) — which I think will be a more performant way to ignore all Markdown within node_modules than an ignore file, allowing me to use a broad **/*.md glob (e.g. **/*.md, !**/node_modules/**)

@wooorm
Copy link
Member

wooorm commented Sep 17, 2017

@davidtheclark 👋

Did you find unified-engine? It’s what powers unified-args. The stuff you’re looking for is probably in lib/finder.

I only know of negation patterns due to the ignore part (for remark, .remarkignore). It used to be ported over from ESLint, but now it’s externalised and in node-ignore.

Note: what exactly are you doing? Globbing may be faster, but the file-in-directory finding itself shouldn’t be super slow either!

@davidtheclark
Copy link
Contributor

what exactly are you doing?

I have repos with more Markdown files to lint that just at the root level. Often there's a docs/ directory full of files. Sometimes there are subdirectories with README.mds of their own. Sometimes there's a monorepo with packages/ that each have their own possibilities. I'd love to recursively search for all .md files without entering any node_modules subdirectories.

@wooorm
Copy link
Member

wooorm commented Sep 17, 2017

👍

Why not just use 'remark .'? That should cover all cases!

@davidtheclark
Copy link
Contributor

Oh geez, I'm sorry! I think while iterating on something I confused myself into thinking that remark . was only ever touching the root directory. Turns out it works. Thanks for the help!

@wooorm
Copy link
Member

wooorm commented Sep 17, 2017

Oh no problem at all! Yeah the directory search stuff is pretty powerful. Let me know if you have suggestions for doc additions to make this more clear!

@karlhorky
Copy link

One thing that would be cool to have in the docs is a globby example for MDX files.

I am using remark-cli with remark-lint-no-dead-urls and I'm using the following in my package.json:

{
  "scripts": {
    "lint-md": "remark \"src/pages/**/*.mdx\""
  }
}

@wooorm
Copy link
Member

wooorm commented Aug 23, 2020

@karlhorky We have much more examples about how the remark and rehype CLIs work in unified-args (linked from the readmes), that has several such examples!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants