Skip to content

link-styler is a JavaScript package that helps you find links in text and replace them with a tag that has custom styling.

Notifications You must be signed in to change notification settings

BehrozShafei/link-styler

 
 

Repository files navigation

link-styler

link-styler is a JavaScript package that helps you find links in text and replace them with a tag that has custom styling.

demo

Installation

You can install link-styler using npm:

npm install link-styler
<script src="https://unpkg.com/link-styler/dist/link-styler.js"></script>

Usage

Here is an example of how to use link-styler:

import { linkStyler } from 'link-styler';

linkStyler.start();

This will output the following:

LinkStyler

By default, link-styler will style the link with '#000000d9' color and '#a9a9a94f' background color by border radius 15px. It will also add an external link icon. You can customize the styling by passing options to the linkStyler function:

const options = {
  bg: true,
  bgColor: '#a9a9a94f',
  textColor: '#000000d9',
  borderRadius: 15,
  showIcon: true,
  iconColor: true,
  pathnameLengthLimit: 20
};

linkStyler.start(options);

Options

link-styler accepts the following options:

Option Default Value Type Optional Description
bg true boolean * -
bgColor '#a9a9a94f' string * -
textColor '#000000d9' string * -
borderRadius 15 number * -
showIcon true boolean * -
iconColor true boolean * -
pathnameLengthLimit 20 number * -

License

link-styler is licensed under the MIT License.

About

link-styler is a JavaScript package that helps you find links in text and replace them with a tag that has custom styling.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 65.3%
  • JavaScript 34.7%