项目作者: righ

项目描述 :
ipynb renderer for ReactJS
高级语言: Jupyter Notebook
项目地址: git://github.com/righ/react-ipynb-renderer.git
创建时间: 2021-06-06T15:58:06Z
项目社区:https://github.com/righ/react-ipynb-renderer

开源协议:Apache License 2.0

下载


React Ipynb Renderer

This is a library to easily draw ipynb in a React application.

npm version
e2e workflow
License
downloads
FOSSA Status


image

Theme

Please choose your favorite combination from the multiple themes available for Jupyter and syntax highlighting.

There are several options for each, allowing you to find the perfect match for your preference.

solarizedl and duotone forest themes monokai and xonokai themes
solarizedl monokai

As for jupyter themes, you may use your own customized CSS. You do not necessarily have to use the prepared jupyter theme.

Formula renderer

You can choose Mathjax or Katex for rendering formulas.

Normally I would recommend choosing react-ipynb-renderer which uses Mathjax.
react-ipynb-renderer-katex is a bit lighter than the mathjax version.

Mathjax Katex
NPM NPM
CodeSandbox CodeSandbox

These will be released at the same time, so the versions will be the same. Even if only one of them has been changed.

Install

  1. $ npm install --save react-ipynb-renderer

or

  1. $ npm install --save react-ipynb-renderer-katex

Usage

Just pass an ipynb json object to IpynbRenderer component.

Simplest example

Using react-ipynb-renderer

  1. import { IpynbRenderer } from "react-ipynb-renderer";
  2. // Jupyter theme
  3. import "react-ipynb-renderer/dist/styles/monokai.css";
  4. // import ipynb file as json
  5. import ipynb from "./test.ipynb";
  6. export const Component = () => {
  7. return (
  8. <IpynbRenderer ipynb={ipynb} ></IpynbRenderer>
  9. );
  10. };

Using react-ipynb-renderer-katex

  1. import { IpynbRenderer } from "react-ipynb-renderer-katex";
  2. // Formula renderer for katex
  3. import 'katex/dist/katex.min.css';
  4. // Jupyter theme
  5. import "react-ipynb-renderer-katex/dist/styles/monokai.css";
  6. // import ipynb file as json
  7. import ipynb from "./test.ipynb";
  8. export const Component = () => {
  9. return (
  10. <IpynbRenderer ipynb={ipynb} ></IpynbRenderer>
  11. );
  12. };

Links

License

FOSSA Status