Skip to content

Commit

Permalink
Modified the handling of markdown links to now use Markdig
Browse files Browse the repository at this point in the history
  • Loading branch information
csharpfritz committed Apr 5, 2020
1 parent f6d96ef commit 78587eb
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions Fritz.Chatbot/Helpers/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,10 @@ namespace Fritz.Chatbot.Helpers
{
public static class StringExtensions
{
// private readonly static Regex _regex = new Regex(@"\[([\w\s?.-]+)\]\(((?:http:\/\/(www\.)?|https:\/\/(www\.)?|http:\/\/|https:\/\/)?[a-z0-9]+(?:[\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(?:[0-9]{1,5})?(?:\/.*)?)\)");

public static string HandleMarkdownLinks(this string value)
{

//foreach (Match match in _regex.Matches(value))
//{

// var title = match.Groups[1]; // The link text (that between the [] in markdown)
// var url = match.Groups[2]; // The url (that between the () in markdown)

// value = value.Replace(match.Value, $"{title} found at {url} ").Replace(" ", " ");

//}

value = Markdig.Markdown.ToPlainText(value);

value = value.Replace("\n", " ");
Expand Down

0 comments on commit 78587eb

Please sign in to comment.