Socket
Socket
Sign inDemoInstall

bs-react-diff-viewer

Package Overview
Dependencies
74
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bs-react-diff-viewer

ReasonML bindings for react-diff-viewer library


Version published
Maintainers
1
Install size
12.2 kB
Created

Changelog

Source

0.1.3 (2020-07-05)

Bug Fixes

  • api: change renderContent function signature (f5e00c3)

Readme

Source

bs-react-diff-viewer

Build Status dependencies Status devDependencies Status peerDependencies Status Greenkeeper badge

ReasonML bindings for react-diff-viewer library.

Installation

npm i --save bs-react-diff-viewer react-diff-viewer

Then add bs-react-diff-viewer as a dependency to bsconfig.json.

Usage

[@react.component]
let make = (~before, ~after) => {
  let renderContent = content =>
    <SyntaxHighlighter language=`JavaScript>
      content
    </SyntaxHighlighter>;
  <ReactDiffViewer
    oldValue=before
    newValue=after
    compareMethod=`words
    splitView=false
    renderContent
    styles={ReactDiffViewer.Styles.make(
      ~wordDiff=Styles.wordDiff,
      ~content=Styles.content,
      ~contentText=Styles.contentText,
      ~lineNumber=Styles.lineNumber,
      ~gutter=Styles.gutter,
      ~diffContainer=Styles.diffContainer,
      (),
    )}
  />;;
};

JSX 2

The package provides fallback for projects using older version of JSX syntax.

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

let make = (~before, ~after, _children) => {
  ...component,
  render: (_self) => {
    let renderContent = content =>
      <SyntaxHighlighter language=`JavaScript>
        {...content}
      </SyntaxHighlighter>;
    <ReactDiffViewer.Jsx2
      oldValue=before
      newValue=after
      compareMethod=`words
      splitView=false
      renderContent
      styles={ReactDiffViewer.Styles.make(
        ~wordDiff=Styles.wordDiff,
        ~content=Styles.content,
        ~contentText=Styles.contentText,
        ~lineNumber=Styles.lineNumber,
        ~gutter=Styles.gutter,
        ~diffContainer=Styles.diffContainer,
        (),
      )}
    />;
  }
};

Keywords

FAQs

Last updated on 05 Jul 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc