mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 09:16:02 +03:00
[GH-ISSUE #441] How does this package relate to markdownlint-cli and markdonwlint-cli2? #367
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#367
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pabrams on GitHub (Oct 7, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/441
I don't understand how these packages are inter-related. Which one should I use?
I tried installing markdownlint alongside markdownlint-cli2.
I
ve tried both of the following commands,markdownlint -c .markdownlint-cli2.jsonc **/.mdmarkdownlint-cli2 -c .markdownlint-cli2.jsonc **/.md`with contents of .markdownlint-cli2.jsonc as follows:
But in both cases, the output states that the expected line length is 80, even though I configured it to 120.
@DavidAnson commented on GitHub (Oct 7, 2021):
Those are two different implementations of a CLI for this library. I blogged about why I created CLI2 here:  https://dlaa.me/blog/post/markdownlintcli2
Only CLI2 supports the CLI2 configuration file format. The length you've tried to set is not being respected because that is a parameter and not a rule. Here are examples of setting it in context:  https://github.com/DavidAnson/markdownlint/search?q=code_block_line_length&type=
@pabrams commented on GitHub (Oct 8, 2021):
I don't even get why the cli packages exist at all. markdownlint has its own command line interface, isn't that what this is?
PS C:> markdownlint
Usage: markdownlint [options] <files|directories|globs>
MarkdownLint Command Line Interface
Options:
-V, --version output the version number
-c, --config [configFile] configuration file (JSON, JSONC, JS, or YAML)
-d, --dot include files/folders with a dot (for example
.github)-f, --fix fix basic errors (does not work with STDIN)
-i, --ignore [file|directory|glob] file(s) to ignore/exclude (default: [])
-j, --json write issues in json format
-o, --output [outputFile] write issues to file (no console)
-p, --ignore-path [file] path to file with ignore pattern(s)
-r, --rules [file|directory|glob|package] custom rule files (default: [])
-s, --stdin read from STDIN (does not work with files)
-h, --help display help for command
PS C:>
@pabrams commented on GitHub (Oct 8, 2021):
What other ways are there to interact with markdownlint, other than via the cli? Is there some gui I don't know about?
@DavidAnson commented on GitHub (Oct 8, 2021):
This library does not include a CLI. The output you show above is from the Ruby implementation of markdownlint (discussed in the Overview section of the README). There are various other ways to use this library, including plugins for various editors (like VS Code). A list of some of the most popular options can be found in the Related section of the README: https://github.com/DavidAnson/markdownlint#related
@pabrams commented on GitHub (Oct 8, 2021):
Oh yeah, I keep ending up at that ruby implementation. Confusing.
@pabrams commented on GitHub (Oct 8, 2021):
How did I even end up with that installed? I don't have gem, or rake, or anything like that. Did I get it via npm?
@pabrams commented on GitHub (Oct 8, 2021):
It looks like the cli for the ruby version is
mdl, notmarkdownlint... according to this@pabrams commented on GitHub (Oct 8, 2021):
I went back and looked at the "overview section of the README", but all that is said about the ruby version is that it inspired your stuff:
That doesn't help me understand what's going on, or how I ended up with it installed
I also reviewed the "ways of using markdownlint" in your "Related" section of the README:
But I still don't understand how I ended up with 'markdownlint' cli... Did I set an alias and forget that I did that?
Anyway, I'll forget about that for a minute, because it seems like it shouldn't really matter - I have markdownlint-cli2, so I'll try to use it. I replace my config file with part of the contents of your example:
and then:
markdownlint-cli2 **/*.md --config .markdownlint-cli2.jsoncand here's part of my output:
How the heck do I get it to respect the line length I want?
@pabrams commented on GitHub (Oct 8, 2021):
So, I'll close this issue, since I don't really care about the ruby version of markdownlint, or how I got it. I opened a new issue just to figure out how to use makrdownlint-cli2. Oops, I think I opened it in this repo, but I guess it would be better in the cli2 repo.... so I'll go do that .
@DavidAnson commented on GitHub (Oct 8, 2021):
You're mixing up the two CLI implementations. CLI2 does not take any "--" command line parameters other than the files to lint. If you just want to customize rule configuration, you can use JSON like you show in a file named
.markdownlint.json in the root of your project and it will automatically be picked up and applied by CLI and CLI2.  If you want to use the richer configuration format supported by only CLI2, you can embed the JSON you have in a file named.markdownlint-cli2.jsoncin the root of your project and it will be picked up automatically. Here is an example of that file structure:  https://github.com/DavidAnson/markdownlint-cli2/blob/main/test/markdownlint-cli2-jsonc-example/.markdownlint-cli2.jsonc@pabrams commented on GitHub (Oct 8, 2021):
Okay thanks for your attention, I'll go try that. I don't get how I ended up with the wrong instructions (I'm extremely confused, and thinking about trying to find some other markdown linter), but I'll try following the ones you give here.
@pabrams commented on GitHub (Oct 8, 2021):
What are all these "OBJ" in your comments, anyway? Is there supposed to be something there? Here's what I see. Are you trying to show something different?
@DavidAnson commented on GitHub (Oct 8, 2021):
The OBJ characters get added by iOS dictation, sorry!
@pabrams commented on GitHub (Oct 8, 2021):
Okay, just making sure my corporate network wasn`t stripping out screenshots, or something....
@pabrams commented on GitHub (Oct 12, 2021):
I finally managed to get it working. I guess my node was corrupted or something, because it only worked after I deleted node_modules and redid
npm install. I also made sure tonpm remove --globalall of markdownlint, markdowlint-cli, and markdownlint-cli2.In case anyone else is as obtuse as I am, here`s my minimum viable repro, which finally gave me the result I wanted.
.markdownlint-cli2.jsonc :
The dependencies in my package.json:
test.md:
command line:
npx markdownlint-cli2 test.mdoutput: