textlint-rule / textlint-rule-no-dead-link

textlint rule to check if all links are alive.
29 stars 11 forks source link

This rule does not work in bibtex file #137

Closed t4t5u0 closed 2 years ago

t4t5u0 commented 2 years ago

my env

node: v16.11.0 npm: 8.0.0

my directory

.
├── node_modules
├── .textlintrc
├── package-lock.json
├── package.json
├── ref.bib
└── ref.md

package.json

{
  "dependencies": {
    "textlint": "^12.1.0",
    "textlint-rule-no-dead-link": "^4.8.0"
  }
}

.textlintrc

{
  "filters": {},
  "rules": {
    "no-dead-link": true
  }
}

ref.bib

@misc{Bluetooth:online,
  author       = {},
  title        = {Bluetooth Technology Overview | Bluetooth\textregistered Technology Website},
  howpublished = {\url{https://www.bluetooth.com/this_is_dead}},
  month        = {},
  year         = {},
  note         = {(Accessed on 12/29/2021)}
}

ref.md

[Bluetooth Technology Overview | Bluetooth\textregistered Technology Website](https://www.bluetooth.com/this_is_dead)

Command and Error Message

❯ npx textlint --rule textlint-rule-no-dead-link .\ref.bib .\ref.md

D:\Develop\t4t5u0\no-dead-link-test\ref.md
  1:79  error  https://www.bluetooth.com/this_is_dead is dead. (404 Not Found)  no-dead-link

✖ 1 problem (1 error, 0 warnings)
azu commented 2 years ago

Probably, textlint just ignore .bib file. It is not the problem of a rule.

npx textlint --rule textlint-rule-no-dead-link .\ref.bib .\ref.md --debug

textlint support markdown and text by default. https://textlint.github.io/docs/configuring.html#plugin https://github.com/textlint/textlint/wiki/Collection-of-textlint-rule#plugin-list You need to get a plugin that support bib format. However, I don't know where that is.

You can force to resolve bib file by using following textlintrc configuration. But, It will cause false-positive.

{
    "plugins": {
        "@textlint/text": {
            "extensions": [".bib"]
        }
    }
}

Maybe related plugin https://github.com/textlint/textlint-plugin-latex2e