@evergreen-wc/eve-highlight
Highlight.js component made with lit element
Last updated a year ago by hutchgrant .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @evergreen-wc/eve-highlight 
SYNC missed versions from official npm registry.

eve-highlight

An Evergreen Highlight.js Web Component

Demo

Install

npm i @evergreen-wc/eve-highlight

Usage

import { html, LitElement } from '@polymer/lit-element';
import '@evergreen-wc/eve-highlight';

// highlightjs themes https://github.com/highlightjs/highlight.js/tree/master/src/styles
import github from '@evergreen-wc/eve-highlight/themes/github.css';

// Javascript example
// Escape $ with \
const code = `
class MyComponent extends LitElement {
  constructor() {
    this.name = 'helloworld'
  }

  renderThing() {
    if(this.name === 'helloworld'){
      console.log(this.name)
    }
  }
}
customElements.define('my-component', MyComponent);
`;

class SomeComponent extends LitElement {
  render() {
    return html`
      <eve-highlight type="js" theme="${github}" code="${code}"></eve-highlight>
    `;
  }
}
customElements.define('some-component', SomeComponent);

Props

Property Description
type Set the syntax type e.g. html, css, js, xml, bash
theme Set the imported CSS file.
code Set the code string to highlight.
hljs Optionally you may wish to use a language not already registered due to optimization. You can import and register the languages in your own hljs object and add it as an attribute.

Current Tags

  • 0.0.9                                ...           latest (a year ago)

8 Versions

  • 0.0.9                                ...           a year ago
  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           2 years ago
  • 0.0.3                                ...           2 years ago
  • 0.0.2                                ...           2 years ago
  • 0.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 3
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |