File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed
Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,25 @@ export const Component = () => {
5252};
5353```
5454
55+ #### How to use this on Next.js
56+
57+ ``` jsx
58+ import dynamic from ' next/dynamic' ;
59+ const IpynbRenderer = dynamic (() => import (' react-ipynb-renderer' ).then ((mod ) => mod .IpynbRenderer ), {
60+ ssr: false
61+ });
62+ // import ipynb file as json
63+ import ipynb from " ./test.ipynb" ;
64+
65+ export const Component = () => {
66+ return (
67+ < IpynbRenderer
68+ ipynb= {ipynb}
69+ / >
70+ );
71+ };
72+ ```
73+
5574### Using react-ipynb-renderer-katex
5675
5776``` jsx
Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ import {
44 MarkdownOptionsForMathjax ,
55 MarkdownForMathjax ,
66} from "./components/MarkdownForMathjax" ;
7- import { BaseProps } from "./types" ;
7+ import { BaseProps , IpynbType } from "./types" ;
88import pkg from "../package.json" ;
99import { defaultHtmlFilter } from "./filters" ;
1010import { Context } from "./context" ;
1111
1212console . debug ( `react-ipynb-renderer@${ pkg . version } is working.` ) ;
1313
14+ export type Ipynb = IpynbType ;
15+
1416export type Props = BaseProps & {
1517 markdownOptions ?: MarkdownOptionsForMathjax ;
1618} ;
Original file line number Diff line number Diff line change 2424
2525 }
2626 div .output_area {
27+ display : flex ;
28+ padding : 5px 0 ;
2729 .prompt {
2830 padding-right : 0 !important ;
2931 }
Original file line number Diff line number Diff line change @@ -69,11 +69,13 @@ export type LanguageType = "python" | "r" | "julia" | "haskell" | "ruby";
6969
7070export type HtmlFilter = ( html : string ) => string ;
7171
72+ export type IpynbType = {
73+ cells : CellType [ ] ;
74+ worksheets ?: { cells : CellType [ ] } [ ] ;
75+ }
76+
7277export type BaseProps = {
73- ipynb : {
74- cells : CellType [ ] ;
75- worksheets ?: { cells : CellType [ ] } [ ] ;
76- } ;
78+ ipynb : IpynbType ;
7779 syntaxTheme ?: SyntaxThemeType ;
7880 language ?: LanguageType ;
7981 bgTransparent ?: boolean ;
You can’t perform that action at this time.
0 commit comments