1.1.3 • Published 7 years ago

preact-highlight v1.1.3

Weekly downloads
129
License
MIT
Repository
github
Last release
7 years ago

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
1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.1.0-alpha.1

7 years ago

1.1.0-alpha.0

7 years ago

1.0.0

7 years ago

0.1.0-0

7 years ago