🚀 DAY 1 OF LAUNCH WEEK: Reachability for Ruby Now in Beta.Learn more →
Socket
Book a DemoInstallSign in
Socket

@incodelang/syntax-highlighting

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@incodelang/syntax-highlighting

Syntax Highlighting

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

@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

FAQs

Package last updated on 04 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts