Skip to content

Latest commit

 

History

History
 
 

transforms-full

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

nteract transforms

This contains all the transforms that nteract uses, which extends all those supported by Jupyter frontends from @nteract/transforms while adding on

  • GeoJSON
  • Plotly
  • Vega

transformime

It's likely you don't need to use this package directly and can instead use a release of the display area (:soon:).

Installation

npm install @nteract/transforms-full

Note: React is a peer dependencies you'll have to install yourself.

Usage

Standard nteract Transforms

import {
  richestMimetype,
  transforms,
  displayOrder,
} from '@nteract/transforms-full'

// Jupyter style MIME bundle
const bundle = {
  'text/plain': 'This is great',
  'image/png': 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
}

// Find out which mimetype is the richest
const mimetype = richestMimetype(bundle, transforms)

// Get the matching React.Component for that mimetype
let Transform = transforms[mimetype]

// Create a React element
return <Transform data={bundle[mimetype]} />

Adding New Transforms

import {
  richestMimetype,
  registerTransform,
  transforms,
  displayOrder,
} from '@nteract/transforms-full'

import someCustomTransform from 'somewhere';

let registry = { transforms, displayOrder };

registry = registerTransform(registry, someCustomTransform);

...

const Transform = registry.transforms[mimetype];