Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

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

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
303
increased by5.21%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 02 Feb 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc