https://github.com/andy840119/JupyterSharpParser
Jupyter parser written in C#
https://github.com/andy840119/JupyterSharpParser
andy840119 csharp jupyter nuget parser
Last synced: about 1 year ago
JSON representation
Jupyter parser written in C#
- Host: GitHub
- URL: https://github.com/andy840119/JupyterSharpParser
- Owner: andy840119
- Created: 2018-11-16T08:00:21.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-23T06:07:12.000Z (over 7 years ago)
- Last Synced: 2024-11-09T06:19:25.042Z (over 1 year ago)
- Topics: andy840119, csharp, jupyter, nuget, parser
- Language: CSS
- Homepage:
- Size: 46.9 MB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JupyterSharpParser
[](https://ci.appveyor.com/project/andy840119/jupytersharpparser)
[](https://www.codefactor.io/repository/github/andy840119/jupytersharpparser)
[](https://www.nuget.org/packages/JupyterSharpParser)
[](https://www.nuget.org/packages/JupyterSharpParser)
[](https://github.com/andy840119/JupyterSharpParser)
Jupyter parser written in C#
Samlpe :
```csharp
var jupyterText = "[Text in jupyer document]";
JupyterDocument document = Jupyter.Parse(jupyterText);
//You can do anything in this document such as add cell
document.Cells.Add(new CodeCell
{
ExecutionCount = 10,
Source = new List{"print(3 * 2)"}
});
```
Convert To Json :
```csharp
// Output
var writer = new StringWriter();
// Create a HTML Renderer and setup it with the pipeline
var renderer = new JsonRenderer(writer);
// Renders Jupyter Document to Json (to the writer)
renderer.Render(document);
// Gets the rendered string
var result = writer.ToString();
```
Convert To Html :
```csharp
// Output
var writer = new StringWriter();
// Create a HTML Renderer and setup it with the pipeline
var renderer = new HtmlRenderer(writer);
// Renders Jupyter Document to Json (to the writer)
renderer.Render(document);
// Gets the rendered string
var result = writer.ToString();
```
Convert To Pdf :
```csharp
//Note : Due to Select.HtmlToPdf.NetCore, PDF limited to most 5 page,
// And cannot work on other platform such as mac and linux.
// Output
using(var stream = new FileStream("fileName"))
{
// Create a HTML Renderer and setup it with the pipeline
var renderer = new PdfRenderer(stream);
// Renders Jupyter Document to Json (to the writer)
renderer.Render(document);
}
```