1.0.7 • Published 1 year ago

link-styler v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Build status npm version install size Build Status Downloads Gitpod Ready-to-Code Known Vulnerabilities CDNJS License

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

link

demo | issues

Installation

You can install link-styler using npm:

npm install link-styler

Usage

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

import { linkStyler } from 'link-styler';

linkStyler.start();
<script src="https://unpkg.com/link-styler/dist/link-styler.js"></script>
<script>
  linkStyler.start();
</script>

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: '#c7c7c7c2',
  textColor: '#000000d9',
  borderRadius: 15,
  showIcon: true,
  iconColor: true,
  underline: false,
  link: {
    pathnameLengthLimit: 20,
  },
  atsign: {
    enable: true,
    path: 'https://www.linkedin.com/in/',
    bg: false,
    textColor: '#e31a1ad9',
    showIcon: true,
    underline: true,
  },
  hashTag: {
    enable: true,
    path: 'https://www.linkedin.com/feed/hashtag/?keywords=',
    bg: false,
    textColor: '#0250ffd9',
    showIcon: true,
    underline: false,
  },
};

linkStyler.start(options);

Options

link-styler accepts the following options:

OptionDefault ValueTypeOptionalDescription
bgtrueboolean*-
bgColor'#a9a9a94f'string*-
textColor'#000000d9'string*-
borderRadius15number*-
showIcontrueboolean*-
iconColortrueboolean*-
underlinefalseboolean*-
link.pathnameLengthLimit20number*-
link.bgboolean*-
link.bgColorstring*-
link.textColorstring*-
link.borderRadiusnumber*-
link.showIconboolean*-
link.iconColorboolean*-
link.underlineboolean*-
atsign.path''string*-
atsign.enabletrueboolean*-
atsign.bgfalseboolean*-
atsign.bgColorstring*-
atsign.textColor'#e31a1ad9'string*-
atsign.borderRadiusnumber*-
atsign.showIconfalseboolean*-
atsign.iconColorboolean*-
atsign.underlinetrueboolean*-
atsign.removeAtsignCharfalseboolean*-
hashTag.enabletrueboolean*-
hashTag.path''string*-
hashTag.bgfalseboolean*-
hashTag.bgColorstring*-
hashTag.textColor'#0250ffd9'string*-
hashTag.borderRadiusnumber*-
hashTag.showIconfalseboolean*-
hashTag.iconColorboolean*-
hashTag.underlinefalseboolean*-
hashTag.removeHashTagCharfalseboolean*-

License

link-styler is licensed under the MIT License.

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago