Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simoncropp/pandocnet
Conversion of documents in .net via Pandoc.
https://github.com/simoncropp/pandocnet
documentconversion pandoc
Last synced: 1 day ago
JSON representation
Conversion of documents in .net via Pandoc.
- Host: GitHub
- URL: https://github.com/simoncropp/pandocnet
- Owner: SimonCropp
- License: mit
- Created: 2021-11-17T02:46:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-28T03:27:14.000Z (19 days ago)
- Last Synced: 2024-10-29T14:54:51.461Z (17 days ago)
- Topics: documentconversion, pandoc
- Language: C#
- Homepage:
- Size: 603 KB
- Stars: 53
- Watchers: 4
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
- Code of conduct: code_of_conduct.md
Awesome Lists containing this project
README
# PandocNet
[![Build status](https://ci.appveyor.com/api/projects/status/naxouwk164twkgn3?svg=true)](https://ci.appveyor.com/project/SimonCropp/PandocNet)
[![NuGet Status](https://img.shields.io/nuget/v/Pandoc.svg)](https://www.nuget.org/packages/Pandoc/)Conversion of documents via [Pandoc](https://pandoc.org/). Wraps pandoc.exe using [CliWrap](https://github.com/Tyrrrz/CliWrap) and provides strong typed options for document formats.
**See [Milestones](../../milestones?state=closed) for release notes.**
## NuGet package
https://nuget.org/packages/Pandoc/
## Usage
### Pandoc Path
By default `pandoc.exe` is expected to be accessible in the current environmenst `Path`.
[Installing Pandoc](https://pandoc.org/installing.html).
This can be changed:
```cs
var engine = new PandocEngine(@"D:\Tools\pandoc.exe");
```
snippet source | anchor### Text
```cs
var html = await PandocInstance.ConvertToText("*text*");
```
snippet source | anchor### Streams
```cs
await using var inStream = File.OpenRead("sample.md");
await using var outStream = File.OpenWrite("output.html");
await PandocInstance.Convert(inStream, outStream);
```
snippet source | anchor### Files
```cs
await PandocInstance.Convert("sample.md", "output.html");
```
snippet source | anchor### Custom Options
```cs
var html = await PandocInstance.ConvertToText(
"""# Heading1
text
## Heading2
text
""",
new CommonMarkIn
{
ShiftHeadingLevelBy = 2
},
new HtmlOut
{
NumberOffsets = new List {3}
});
```
snippet source | anchor## Icon
[Pan Flute](https://thenounproject.com/term/pan+flute/1526666/) designed by [Creaticca Creative Agency](https://thenounproject.com/creaticca/) from [The Noun Project](https://thenounproject.com/).