Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andy840119/jupytersharpparser
Jupyter parser written in C#
https://github.com/andy840119/jupytersharpparser
andy840119 csharp jupyter nuget parser
Last synced: 3 months 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 (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-23T06:07:12.000Z (almost 6 years ago)
- Last Synced: 2024-11-09T06:19:25.042Z (3 months 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
[![Build status](https://ci.appveyor.com/api/projects/status/awnpnnvevkj51b8m?svg=true)](https://ci.appveyor.com/project/andy840119/jupytersharpparser)
[![CodeFactor](https://www.codefactor.io/repository/github/andy840119/jupytersharpparser/badge)](https://www.codefactor.io/repository/github/andy840119/jupytersharpparser)
[![NuGet](https://img.shields.io/nuget/v/JupyterSharpParser.svg)](https://www.nuget.org/packages/JupyterSharpParser)
[![NuGet](https://img.shields.io/nuget/dt/JupyterSharpParser.svg)](https://www.nuget.org/packages/JupyterSharpParser)
[![NuGet](https://img.shields.io/badge/月子我婆-passed-ff69b4.svg)](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);
}
```