@incodelang/syntax-highlighting
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

@incodelang/syntax-highlighting

This package allows you to highlight a custom programming language on a website.

Installation

Install @incodelang/syntax-highlighting with npm

  npm install @incodelang/syntax-highlighting

Install @incodelang/syntax-highlighting with yarn

  yarn add @incodelang/syntax-highlighting

Usage/Examples

import highlight from '@incodelang/syntax-highlighting'

highlight(
    document.querySelector("code"),
    [
        {
            name: "fn-call",
            match: /x/,
            style: {
                color: '#FFF'
            }
        },
        {
            name: "fn-call2",
            match: /y/,
            style: {
                color: '#222'
            }
        }
        {
            name: "fn-call3",
            match: /z/,
            style: {
                color: '#333'
            }
        }
    ]
)

Each pattern name will generate a CSS-Class with the exact same name and the corresponding style properties. So you can set custom style properties using

.your-papper-name {
    your-css-prop: your-css-value
}

Example:

.fn-call {
    line-height: 1.6;
}

License

GNU General Public License 3.0 only

Readme

Keywords

none

Package Sidebar

Install

npm i @incodelang/syntax-highlighting

Weekly Downloads

2

Version

1.0.3

License

GPL-3.0-only

Unpacked Size

41.8 kB

Total Files

12

Last publish

Collaborators

  • mctzock