New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-kode

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-kode

React Component of code-block in HTML with highlight.js

Source
npmnpm
Version
0.0.7
Version published
Weekly downloads
37
76.19%
Maintainers
1
Weekly downloads
 
Created
Source

react-kode

A react component that integrates highlight.js with advance.

See the Pen react-kode by andyyou (@andyyou) on CodePen.

Features

  • Support theme by highlight.js
  • Support line number.

Usage

Dependencies

Getting start with CRA

$ npx create-react-app demo
$ cd demo
$ npm i highlight.js react-kode

Open src/index.js

import React from 'react';
import ReactDOM from 'react-dom';

// Import theme stylesheet.and react-kode
import 'highlight.js/styles/solarized-dark.css';
import Kode from 'react-kode';

const html = `
<html>
  <div class="navbar">
    <a href="#">Go</a>
  </div>
</html>
`;

const App = () => (
  <div>
    <Kode
      lang="html"
      isEnableLineNumber={true}
    >
      {html}
    </Kode>
  </div>
);

ReactDOM.render(<App />, document.getElementById('root'));

CDN

<!--
  highlight.js
  https://highlightjs.org/download/
-->
<link rel="stylesheet"
      href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
<!--
  React
  https://reactjs.org/docs/cdn-links.html
 -->
<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<!--
  react-kode
-->
<script crossorigin src="https://unpkg.com/react-kode@latest/dist/react-kode.js"></script>

NPM

Install react-kode.

# Install dependencies.
$ npm i react highlight.js

# Install react-kode.
$ npm i  react-kode

Contributors

Development

# Build
$ npm run build

# Dev
$ npm run storybook

Keywords

react

FAQs

Package last updated on 18 Jan 2019

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