prism-highlight

WebJar for prism-highlight

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

org.webjars.bowergithub.advanced-rest-client
ArtifactId

ArtifactId

prism-highlight
Last Version

Last Version

3.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

prism-highlight
WebJar for prism-highlight
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/advanced-rest-client/prism-highlight

Download prism-highlight

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/prism-highlight/ -->
<dependency>
    <groupId>org.webjars.bowergithub.advanced-rest-client</groupId>
    <artifactId>prism-highlight</artifactId>
    <version>3.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/prism-highlight/
implementation 'org.webjars.bowergithub.advanced-rest-client:prism-highlight:3.0.3'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.advanced-rest-client/prism-highlight/
implementation ("org.webjars.bowergithub.advanced-rest-client:prism-highlight:3.0.3")
'org.webjars.bowergithub.advanced-rest-client:prism-highlight:jar:3.0.3'
<dependency org="org.webjars.bowergithub.advanced-rest-client" name="prism-highlight" rev="3.0.3">
  <artifact name="prism-highlight" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.advanced-rest-client', module='prism-highlight', version='3.0.3')
)
libraryDependencies += "org.webjars.bowergithub.advanced-rest-client" % "prism-highlight" % "3.0.3"
[org.webjars.bowergithub.advanced-rest-client/prism-highlight "3.0.3"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.bowergithub.polymer : polymer jar [2.0.0,3)
org.webjars.bowergithub.polymerelements : prism-element jar [2.1.0,3)
org.webjars.bowergithub.polymerelements : paper-button jar [2.1.0,3)
org.webjars.bowergithub.polymerelements : paper-progress jar [2.1.0,3)

Project Modules

There are no modules declared in this project.

Published on NPM

Build Status

Published on webcomponents.org

<prism-highlight>

Syntax highlighting with Prism JS library

<prism-highlight id="c2" lang="javascript"></prism-highlight>
<script>
document.querySelector('#c2').code = 'function(param) {\n' +
  '  param.forEach((item) => this._parseItem(item))\n' +
  '  const test = null;\n' +
  '}';
</script>

API components

This components is a part of API components ecosystem

Usage

Installation

npm install --save @advanced-rest-client/prism-highlight

In an html file

<html>
  <head>
    <script type="module">
      import '@advanced-rest-client/prism-highlight/prism-highlight.js';
    </script>
  </head>
  <body>
    <prism-highlight></prism-highlight>
  </body>
</html>

In a LitElement template

import { LitElement, html } from 'lit-element';
import '@advanced-rest-client/prism-highlight/prism-highlight.js';

class SampleElement extends LitElement {

  render() {
    return html`
    <prism-highlight .code="${this.code}" .lang="${this.lang}"></prism-highlight>
    `;
  }
}
customElements.define('sample-element', SampleElement);

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@advanced-rest-client/prism-highlight/prism-highlight.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
    <prism-highlight></prism-highlight>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Development

git clone https://github.com/advanced-rest-client/prism-highlight
cd prism-highlight
npm install

Running the demo locally

npm start

Running the tests

npm test

Changes in version 4

  • The component supports only few syntax highlighting by default. It won't load other languages at runtime. The component consumer has to download definition before highlighting the code.
  • The component no longer uses Web Workers.
  • Replaced Polymer with LitElement
org.webjars.bowergithub.advanced-rest-client

ARC

A set of repositories related to the Advanced REST Client and API console (by Mulesoft)

Versions

Version
3.0.3