0.4.1 • Published 4 years ago

remark-color-text v0.4.1

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

remark-color-text

npm

GitHub followers GitHub stars

remark plugin to color text via block and inline text in Markdown.

Installation

npm i remark-color-text

Usage

import remark from 'remark'
import html from 'remark-html'
import color from 'remark-color-text'

remark()
  .use(html)
  .use(color)

...

Options

.use(color [, options])

Add the color plugin to remark.

options

options.token

Token used to open and close colored text.

Default !#

options.colorExpression

Regular expression used to get the color from a tokenized block. The first capture group is set as the color.

Default /^\s*(rgba?\(\d{1,3}\s*\,\s*\d{1,3}\s*\,\s*\d{1,3}\s*(\,\s*\d{1,3}\s*)?\)|(\#?[A-z0-9]{3,12}))?/

options.lowercase

Make sure color strings are always in lowercase. CSS colors are usually lowercase in order to function correctly.

Default true

Examples

# Worded colors
!# red
Hello I should be in red text :D
!#

!# red (this is inline!)

# 3 Character hex
!# #AAA
Hello!
!#

!# #AAA (this is inline!)

# 6 Character hex
!# #DADADA
Hello!
!#

!# #DADADA (this is inline!)

# RGB
!# rgb(255,255,255)
Hello!
!#

!# rgb(255,255,255) (this is inline!)

# RGBA
!# rgba(255,255,255,50)
Hello!
!#

!# rgba(255,255,255,50) (this is inline!)
0.4.1

4 years ago

0.4.0

4 years ago

0.3.11

4 years ago

0.3.9

4 years ago

0.3.10

4 years ago

0.1.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago