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

MD013 : Issue with MarkdownLint Configuration Ignoring Line Length Exceeding 80 Words #1136

Closed
SOHAN-cyber opened this issue Feb 22, 2024 · 3 comments
Labels

Comments

@SOHAN-cyber
Copy link

SOHAN-cyber commented Feb 22, 2024

I've encountered while configuring MarkdownLint to ignore line length exceeding 80 words. Despite following the official documentation's guidance, the line length issue persists, and I seek assistance in resolving it.

Here's the current configuration I've set up:

 ---
# MarkdownLint YAML configuration file
#   https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#markdownlint-cli2yaml
#   https://github.com/DavidAnson/markdownlint-cli2/blob/main/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml

config:
  # MD013/line-length: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md013.md
  line-length:
    tables: false # Do not complain about wide tables generated by Terraform Docs

# Fix any fixable errors
fix: true

# Define glob expressions to ignore
ignores:
  # MarkdownLint detects this file as a '.markdown' file
  - "**/.markdownlint-cli2.yaml"

I've integrated this configuration into the pre-commit setup as follows:

  - repo: https://github.com/DavidAnson/markdownlint-cli2
    rev: v0.12.1
    hooks:
      - id: markdownlint-cli2
        args:
          - extern/make/.config/.markdownlint-cli2.yaml

Despite these settings, MarkdownLint continues to flag lines exceeding 80 characters, contrary to my intent to ignore this rule. I'm uncertain where the misconfiguration lies and would appreciate any guidance or adjustments you could provide to resolve this issue effectively.

@DavidAnson
Copy link
Owner

The pre-commit configuration above is using "args" to say the YAML configuration file should be linted (and nothing else). You probably want to use the --config option and pass a glob like "**/*.md". Once that problem is fixed, the "ignores" override you have should no longer be necessary and the other configuration should be applied as expected.

@SOHAN-cyber
Copy link
Author

SOHAN-cyber commented Feb 23, 2024

@DavidAnson I have try to add the below configuration. Which you have suggested but after that also It is not ignoring the file

pre-commit-hook.yaml

  - repo: https://github.com/DavidAnson/markdownlint-cli2
    rev: v0.12.1
    hooks:
      - id: markdownlint-cli2
        args:
          - --config
          - extern/make/.config/.markdownlint-cli2.yaml

markdownlint-cli2.yaml

---
# MarkdownLint YAML configuration file
#   https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#markdownlint-cli2yaml
#   https://github.com/DavidAnson/markdownlint-cli2/blob/main/test/markdownlint-cli2-yaml-example/.markdownlint-cli2.yaml

config:
  # MD013/line-length: https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md013.md
  line-length:
    tables: false # Do not complain about wide tables generated by Terraform Docs
    line_length: 255

# Fix any fixable errors
fix: true

# Define glob expressions to ignore
ignores:
  # MarkdownLint detects this file as a '.markdown' file
  - "**/.markdownlint-cli2.yaml"
  - "**/*.md"

Could you provide me the pre-commit hook config which I need to use in markdownlint-cli2 to ignore the line-length issue in table.

Error:

markdownlint-cli2........................................................Failed
- hook id: markdownlint-cli2
- exit code: 1

markdownlint-cli2 v0.12.1 (markdownlint v0.33.0)
Finding: --config=extern/make/.config/.markdownlint-cli2.yaml .gitlab/issue_templates/Default.md development/ec2/README.md CHANGELOG.md development/vpc/README.md
Linting: 4 file(s)
Summary: 37 error(s)
CHANGELOG.md:1 MD041/first-line-heading/first-line-h1 First line in a file should be a top-level heading [Context: "## v0.2.0 (2024-02-15)"]
development/ec2/README.md:23:81 MD013/line-length Line length [Expected: 80; Actual: 126]
development/ec2/README.md:24:81 MD013/line-length Line length [Expected: 80; Actual: 126]
development/ec2/README.md:25:81 MD013/line-length Line length [Expected: 80; Actual: 126]
development/ec2/README.md:26:81 MD013/line-length Line length [Expected: 80; Actual: 126]
development/ec2/README.md:27:81 MD013/line-length Line length [Expected: 80; Actual: 126]
development/ec2/README.md:31:81 MD013/line-length Line length [Expected: 80; Actual: 151]
development/ec2/README.md:32:81 MD013/line-length Line length [Expected: 80; Actual: 151]
development/ec2/README.md:39:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:40:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:41:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:42:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:43:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:44:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:45:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:46:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:47:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:48:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:49:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:50:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:51:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:52:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:53:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:54:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:55:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:56:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/ec2/README.md:57:81 MD013/line-length Line length [Expected: 80; Actual: 349]
development/vpc/README.md:28:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:29:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:30:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:31:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:32:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:33:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:34:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:35:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:36:81 MD013/line-length Line length [Expected: 80; Actual: 208]
development/vpc/README.md:37:81 MD013/line-length Line length [Expected: 80; Actual: 208]
markdownlint-cli2 v0.12.1 (markdownlint v0.33.0)
Finding: --config=extern/make/.config/.markdownlint-cli2.yaml .gitlab/merge_request_templates/Default.md .gitlab/issue_templates/Report_Bug.md common/vpc-skeleton/README.md development/vpc_peering/README.md
Linting: 4 file(s)
Summary: 138 error(s)
common/vpc-skeleton/README.md:20:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:21:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:22:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:23:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:24:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:25:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:26:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:27:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:28:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:29:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:30:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:31:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:32:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:33:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:34:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:35:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:36:81 MD013/line-length Line length [Expected: 80; Actual: 136]
common/vpc-skeleton/README.md:44:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:45:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:46:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:47:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:48:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:49:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:50:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:51:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:52:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:53:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:54:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:55:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:56:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:57:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:58:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:59:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:60:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:61:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:62:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:63:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:64:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:65:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:66:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:67:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:68:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:69:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:70:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:71:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:72:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:73:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:74:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:75:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:76:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:77:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:78:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:79:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:80:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:81:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:82:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:83:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:84:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:85:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:86:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:87:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:88:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:89:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:90:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:91:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:92:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:93:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:94:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:95:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:96:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:97:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:98:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:99:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:100:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:101:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:102:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:103:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:104:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:105:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:106:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:107:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:108:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:109:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:110:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:111:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:112:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:113:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:114:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:115:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:116:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:117:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:118:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:119:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:120:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:121:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:122:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:123:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:124:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:125:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:126:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:127:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:128:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:129:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:130:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:131:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:132:81 MD013/line-length Line length [Expected: 80; Actual: 252]
common/vpc-skeleton/README.md:133:81 MD013/line-length Line length [Expected: 80; Actual: 252]
development/vpc_peering/README.md:26:81 MD013/line-length Line length [Expected: 80; Actual: 178]
development/vpc_peering/README.md:27:81 MD013/line-length Line length [Expected: 80; Actual: 178]
development/vpc_peering/README.md:42:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:43:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:44:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:45:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:46:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:47:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:48:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:49:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:50:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:51:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:52:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:53:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:54:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:55:81 MD013/line-length Line length [Expected: 80; Actual: 268]
development/vpc_peering/README.md:59:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:60:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:61:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:62:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:63:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:64:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:65:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:66:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:67:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:68:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:69:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:70:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:71:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:72:81 MD013/line-length Line length [Expected: 80; Actual: 105]
development/vpc_peering/README.md:73:81 MD013/line-length Line length [Expected: 80; Actual: 105]

@DavidAnson
Copy link
Owner

This tool shows what it's doing at the beginning of its output. You can see that in your bottom snippet as something that looks like this: Finding: --config=extern/make/.config/.markdownlint-cli2.yaml .gitlab/issue_templates/Default.md ...

That tells us the syntax for "--config" was wrong because "=" should not be used there. The pre-commit syntax you show above looks reasonable to me, but I do not use pre-commit. In my own smoke test for pre-commit integration, I use this syntax and it seems to behave as expected: args: [--config, configuration/.markdownlint-cli2.jsonc]

@DavidAnson DavidAnson closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants