0.1.0 • Published 6 years ago

@cnguy/bs-react-highlight v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

bs-react-highlight

Introduction

ReasonReact bindings for react-highlight.

State: Published

Installation

1

  • With yarn

yarn add @cnguy/bs-react-highlight

  • With npm

npm install --save @cnguy/bs-react-highlight

2

Add @cnguy/bs-react-highlight to bsconfig.json bs-dependencies.

3

Add a highlight.js theme.

For example:

<html>
<head>
  <link
    rel="stylesheet"
    type="text/css"
    href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/atom-one-dark.min.css"
  />
</head>
<body>
  <div id="root" />
  <script src="bundle.js"></script>
</body>
</html>

Usage

Implicit:

let component = ReasonReact.statelessComponent("App");

let code = "
  function helloWorld() {
    console.log('Hello, world!')
  }
";

let make = _children => {
  ...component,
  render: _self => <Highlight> ...code </Highlight>
};

Explicit:

let component = ReasonReact.statelessComponent("App");

let code = "
    print(\"Hello, world!\")
  ";

let make = _children => {
  ...component,
  render: _self => <Highlight className="python"> ...code </Highlight>,
};

innerHTML:

let component = ReasonReact.statelessComponent("App");

let code = "
    <h1>Hello, world!</h1>
  ";

let make = _children => {
  ...component,
  render: _self => <Highlight innerHTML=true> ...code </Highlight>,
};

Changes

0.1.0

Release

Contributing

Development

yarn start # npm run start
0.1.0

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago