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

material-ui-linkify

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

material-ui-linkify

Converts links in text to Material-UI Links using the Markdown Linkify library

  • 1.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
decreased by-3.23%
Maintainers
1
Weekly downloads
 
Created
Source

material-ui-linkify

Converts links in text to Material-UI Links using the Markdown-it Linkify-it library Uses https://github.com/markdown-it/linkify-it Inspired by https://github.com/tasti/react-linkify/

Installation

npm install material-ui-linkify --save

Usage

<MuiLinkify>
  <Typography variant="body1">
    See source code at https://github.com/alexplumb/material-ui-linkify
  </Typography>
</MuiLinkify>

Properties

schema - A linkify-it schema for adding linkify processors. Example for adding Twitter:

{
  '@': {
    validate (text, pos, self) {
      const tail = text.slice(pos);

      if (!self.re.twitter) {
        self.re.twitter =  new RegExp(
          `^([a-zA-Z0-9_]){1,15}(?!_)(?=$|${self.re.src_ZPCc})`,
        );
      }
      if (self.re.twitter.test(tail)) {
        // Linkifier allows punctuation chars before prefix,
        // but we additionally disable `@` ("@@mention" is invalid)
        if (pos >= 2 && tail[pos - 2] === '@') {
          return false;
        }
        return tail.match(self.re.twitter)[0].length;
      }
      return 0;
    },
    normalize: (match) => {
      match.url = `https://twitter.com/${match.url.replace(/^@/, '')}`;
    },
  },
}

options: See https://github.com/markdown-it/linkify-it#new-linkifyitschemas-options for options

LinkProps: Properties that you want to pass along to the Link component. See https://material-ui.com/api/link/ for the full API

hostnameOnly: Forces certain schemas to only display the hostnames for matched links (boolean, default: false)

hostnameSchemas: When hostnameOnly is set to true, pass an array of schemas that determines which types of URLs to be truncated. (default: https:, http:, ftp:, //)

Notes

This library requires the URL interface. If you need to support IE, make sure to install a polyfill.

License

Uses the MIT License

Keywords

FAQs

Package last updated on 17 Jul 2019

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