Socket
Socket
Sign inDemoInstall

preact-highlight

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    preact-highlight

a syntax highlight component for preact


Version published
Weekly downloads
54
decreased by-15.62%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

1.1.3 (2017-06-23)

<a name="1.1.2"></a>

Readme

Source

preact-highlight

a syntax highlight component for preact, base on awesome highlight.js

features

  • self managed theme style
  • cache highlight result
  • support multi-theme in same component

usage

step.1

link theme stylesheets

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css">
step.2

use it with your preact application

const { h, Component } = require('preact');
const { HighLight, Theme } = require('preact-highlight');
const demo = {
  a: 1,
  b: [ 1, 2, 3 ],
};

class CodeArea extends Component {
  render() {
    return <HighLight className="cmp-high-light" code={demo} theme={Theme.}/>;
  }
}
module.exports = CodeArea;

note

HighLight component code property had supported string or json or object and function

propertytypedescription
classNamestringcss style classname
codestring or json or object and functioncode snippet which need highlight
languagestringuse which language
themestringuse which theme

Keywords

FAQs

Last updated on 23 Jun 2017

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc