Socket
Socket
Sign inDemoInstall

remark-lint-no-empty-image-alt-text

Package Overview
Dependencies
9
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    remark-lint-no-empty-image-alt-text

remark-lint rule to warn when alt text for image will be missing


Version published
Weekly downloads
482
decreased by-18.72%
Maintainers
1
Install size
96.1 kB
Created
Weekly downloads
 

Readme

Source

remark-lint-no-empty-image-alt-text

This remark-lint rule is created to check if all images have alt text or not. This will help to get standard accessibility for images.

<!-- Invalid -->

![](<image-path>)

<!-- Valid -->

![alt text](<image-path>)

Using the rule

With remark

Let’s say example.js looks as follows:

var report = require('vfile-reporter')
var remark = require('remark')
var remarkLint = require('remark-lint');
var imageAltText = require('remark-lint-no-empty-image-alt-text')

var file = remark()
            .use(remarkLint)
            .use(imageAltText)
            .processSync('![](./media/example.png)')

console.log(report(file))

Now, running node example.js yields:

  1:1-1:25  warning  Missing alt text for image!  no-empty-image-alt-text  remark-lint

⚠ 1 warning

Via .remarkrc

npm install -g remark-cli
npm install remark-lint remark-lint-no-empty-image-alt-text

Then, set up your .remarkrc:

{
  "plugins": [
    "lint",
    "lint-no-empty-image-alt-text"
  ]
}

Now you can use the following command to run the lint:

remark xxx.md

Via CLI

npm install -g remark-cli
npm install remark-lint remark-lint-no-empty-image-alt-text
remark -u lint -u lint-no-empty-image-alt-text xxx.md

Keywords

FAQs

Last updated on 02 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc