link-styler
is a JavaScript package that helps you find links in text and replace them with a tag that has custom styling.
You can install link-styler using npm:
npm install link-styler
<script src="https://unpkg.com/link-styler/dist/link-styler.js"></script>
Here is an example of how to use link-styler:
import { linkStyler } from 'link-styler';
linkStyler.start();
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);
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 | * | - |
link-styler is licensed under the MIT License.