All Projects → mysticmind → Reversemarkdown Net

mysticmind / Reversemarkdown Net

Licence: mit
ReverseMarkdown.Net is a Html to Markdown converter library in C#. Conversion is very reliable since HtmlAgilityPack (HAP) library is used for traversing the Html DOM

Projects that are alternatives of or similar to Reversemarkdown Net

Mathos Parser
A mathematical expression parser and evaluation library.
Stars: ✭ 26 (-77.59%)
Mutual labels:  netstandard, netcore
Alphavantage.net
.Net client library for Alpha Vantage API
Stars: ✭ 52 (-55.17%)
Mutual labels:  netstandard, netcore
Markdown
A super fast, highly extensible markdown parser for PHP
Stars: ✭ 945 (+714.66%)
Mutual labels:  markdown, markdown-to-html
Easy Pandoc Templates
A collection of portable pandoc templates with no dependencies
Stars: ✭ 23 (-80.17%)
Mutual labels:  markdown, markdown-to-html
Markdeck
presentations as code - author cool slide decks, text-only, offline-ready, collaborative
Stars: ✭ 1,159 (+899.14%)
Mutual labels:  markdown, markdown-to-html
Markitdown
📱 A React app to preview and edit Markdown✍. You can also export it as HTML.
Stars: ✭ 26 (-77.59%)
Mutual labels:  markdown, markdown-to-html
Couchdb Net
EF Core-like CouchDB experience for .NET!
Stars: ✭ 50 (-56.9%)
Mutual labels:  netstandard, netcore
Marker
🖊 A gtk3 markdown editor
Stars: ✭ 644 (+455.17%)
Mutual labels:  markdown, markdown-to-html
Solr Express
A simple and lightweight query .NET library for Solr, in a controlled, buildable and fail fast way.
Stars: ✭ 66 (-43.1%)
Mutual labels:  netstandard, netcore
Abotx
Cross Platform C# Web crawler framework, headless browser, parallel crawler. Please star this project! +1.
Stars: ✭ 63 (-45.69%)
Mutual labels:  netstandard, netcore
Docpress
Documentation website generator
Stars: ✭ 815 (+602.59%)
Mutual labels:  markdown, markdown-to-html
Nlua
Bridge between Lua and the .NET.
Stars: ✭ 1,326 (+1043.1%)
Mutual labels:  netstandard, netcore
Zola
A fast static site generator in a single binary with everything built-in. https://www.getzola.org
Stars: ✭ 7,823 (+6643.97%)
Mutual labels:  markdown, markdown-to-html
Raft.net
Implementation of RAFT distributed consensus algorithm among TCP Peers on .NET / .NETStandard / .NETCore / dotnet
Stars: ✭ 112 (-3.45%)
Mutual labels:  netstandard, netcore
Epplus
EPPlus 5-Excel spreadsheets for .NET
Stars: ✭ 693 (+497.41%)
Mutual labels:  netstandard, netcore
Metalsmith
An extremely simple, pluggable static site generator.
Stars: ✭ 7,692 (+6531.03%)
Mutual labels:  markdown, markdown-to-html
Nlog
NLog - Advanced and Structured Logging for Various .NET Platforms
Stars: ✭ 5,296 (+4465.52%)
Mutual labels:  netstandard, netcore
Daux.io
Daux.io is an documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way.
Stars: ✭ 603 (+419.83%)
Mutual labels:  markdown, markdown-to-html
Singularity
A extremely fast ioc container for high performance applications
Stars: ✭ 63 (-45.69%)
Mutual labels:  netstandard, netcore
Macdown
Open source Markdown editor for macOS.
Stars: ✭ 8,855 (+7533.62%)
Mutual labels:  markdown, markdown-to-html

Meet ReverseMarkdown

Windows Build status Windows Build status NuGet Version

ReverseMarkdown is a Html to Markdown (http://daringfireball.net/projects/markdown/syntax) converter library in C#. Conversion is very reliable since HtmlAgilityPack (HAP) library is used for traversing the Html DOM.

Note that the library implementation is based on the Ruby based Html to Markdown converter xijo/reverse_markdown.

Usage

Install the package from NuGet using Install-Package ReverseMarkdown or clone the repository and built it yourself.

var converter = new ReverseMarkdown.Converter();

string html = "This a sample <strong>paragraph</strong> from <a href=\"http://test.com\">my site</a>";

string result = converter.Convert(html);

snippet source | anchor

Will result in:

This a sample **paragraph** from [my site](http://test.com)

snippet source | anchor

The conversion can be customized:

var config = new ReverseMarkdown.Config
{
    // Include the unknown tag completely in the result (default as well)
    UnknownTags = Config.UnknownTagsOption.PassThrough,
    // generate GitHub flavoured markdown, supported for BR, PRE and table tags
    GithubFlavored = true,
    // will ignore all comments
    RemoveComments = true,
    // remove markdown output for links where appropriate
    SmartHrefHandling = true
};

var converter = new ReverseMarkdown.Converter(config);

snippet source | anchor

Configuration options

  • DefaultCodeBlockLanguage - Option to set the default code block language for Github style markdown if class based language markers are not available

  • GithubFlavored - Github style markdown for br, pre and table. Default is false

  • ListBulletChar - Allows to change the bullet character. Default value is -. Some systems expect the bullet character to be * rather than -, this config allows to change it.

  • RemoveComments - Remove comment tags with text. Default is false

  • SmartHrefHandling - how to handle <a> tag href attribute

    • false - Outputs [{name}]({href}{title}) even if name and href is identical. This is the default option.

    • true - If name and href equals, outputs just the name. Note that if Uri is not well formed as per Uri.IsWellFormedUriString (i.e string is not correctly escaped like http://example.com/path/file name.docx) then markdown syntax will be used anyway.

      If href contains http/https protocol, and name doesn't but otherwise are the same, output href only

      If tel: or mailto: scheme, but afterwards identical with name, output name only.

  • UnknownTags - handle unknown tags.

    • UnknownTagsOption.PassThrough - Include the unknown tag completely into the result. That is, the tag along with the text will be left in output. This is the default
    • UnknownTagsOption.Drop - Drop the unknown tag and its content
    • UnknownTagsOption.Bypass - Ignore the unknown tag but try to convert its content
    • UnknownTagsOption.Raise - Raise an error to let you know
  • PassThroughTags - Pass a list of tags to pass through as-is without any processing.

  • WhitelistUriSchemes - Specify which schemes (without trailing colon) are to be allowed for <a> and <img> tags. Others will be bypassed (output text or nothing). By default allows everything.

    If string.Empty provided and when href or src schema couldn't be determined - whitelists

    Schema is determined by Uri class, with exception when url begins with / (file schema) and // (http schema)

  • TableWithoutHeaderRowHandling - handle table without header rows

    • TableWithoutHeaderRowHandlingOption.Default - First row will be used as header row (default)
    • TableWithoutHeaderRowHandlingOption.EmptyRow - An empty row will be added as the header row

Note that UnknownTags config has been changed to an enumeration in v2.0.0 (breaking change)

Features

  • Supports all the established html tags like h1, h2, h3, h4, h5, h6, p, em, strong, i, b, blockquote, code, img, a, hr, li, ol, ul, table, tr, th, td, br
  • Can deal with nested lists
  • Github Flavoured Markdown conversion supported for br, pre and table. Use var config = new ReverseMarkdown.Config(githubFlavoured:true);. By default table will always be converted to Github flavored markdown immaterial of this flag.

Copyright

Copyright © 2020 Babu Annamalai

License

ReverseMarkdown is licensed under MIT. Refer to License file for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].