MobileDocKit 0.2.2
Mobiledoc parser/rendering library for .NET Core.
Install-Package MobileDocKit -Version 0.2.2
dotnet add package MobileDocKit --version 0.2.2
<PackageReference Include="MobileDocKit" Version="0.2.2" />
paket add MobileDocKit --version 0.2.2
#r "nuget: MobileDocKit, 0.2.2"
After adding the package reference to your project, you can use the following code to parse a piece of mobiledoc content:
var doc = MobileDocSerializer.Deserialize(someDocumentContent);
Similarly, you can serialize mobiledoc content using the following code:
MobileDocSerializer.Serialize(mobileDocContent);
If you're looking to create mobiledoc content programmatically,
you can build a mobiledoc document using the builder interface:
var document = new MobileDocBuilder()
.WithMarkupSection(section => section
.WithTagName("p")
.WithMarker(new int[] { }, 0, "Hello world"))
.Build();
Finally, if you want to render mobiledoc to HTML, use the MobileDocRenderer:
var renderer = new MobileDocRenderer(new CardSectionRenderer[] { }, new AtomRenderer[] { });
var htmlContent = renderer.Render(mobileDocInstance);
Make sure to write your own card renderers and atom renderers for any custom cards and atoms that you're using in your documents.
Add them to the parameters, specified in the constructor of the MobileDocRenderer
.
Learning more about mobiledoc
You can learn more about the mobiledoc format in
the official specification.
After adding the package reference to your project, you can use the following code to parse a piece of mobiledoc content:
var doc = MobileDocSerializer.Deserialize(someDocumentContent);
Similarly, you can serialize mobiledoc content using the following code:
MobileDocSerializer.Serialize(mobileDocContent);
If you're looking to create mobiledoc content programmatically,
you can build a mobiledoc document using the builder interface:
var document = new MobileDocBuilder()
.WithMarkupSection(section => section
.WithTagName("p")
.WithMarker(new int[] { }, 0, "Hello world"))
.Build();
Finally, if you want to render mobiledoc to HTML, use the MobileDocRenderer:
var renderer = new MobileDocRenderer(new CardSectionRenderer[] { }, new AtomRenderer[] { });
var htmlContent = renderer.Render(mobileDocInstance);
Make sure to write your own card renderers and atom renderers for any custom cards and atoms that you're using in your documents.
Add them to the parameters, specified in the constructor of the MobileDocRenderer
.
Learning more about mobiledoc
You can learn more about the mobiledoc format in
the official specification.
Release Notes
v0.2.2
* New: Added support for rendering HTML from mobiledoc.
* Fixed: Changed list parsing behavior, so it supports actual list items.
v0.1.0
* New: Added support for generating mobiledoc instances from code.
* New: Added support for parsing mobiledoc content.
Dependencies
-
.NETStandard 2.1
- HtmlAgilityPack (>= 1.11.24)
- Newtonsoft.Json (>= 12.0.3)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version History
Version | Downloads | Last updated |
---|---|---|
0.2.2 | 124 | 7/11/2020 |