A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mysticmind/reversemarkdown-net below:

mysticmind/reversemarkdown-net: 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

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

If you have used and benefitted from this library. Please feel free to buy me a coffee!

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

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

This library's initial implementation ideas were from the Ruby based Html to Markdown converter xijo/reverse_markdown.

Copyright © Babu Annamalai

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4