Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented an option to enable Github-Falboured-Markup style linebreaks - i.e. no double space required #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ Debug
*.minime-options
*.zip
*.nupkg

_ReSharper.*
16 changes: 13 additions & 3 deletions MarkdownDeep/MardownDeep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Text;
using System.Text.RegularExpressions;

namespace MarkdownDeep
{

Expand Down Expand Up @@ -67,6 +68,11 @@ public string Transform(string str)
// Transform a string
public string Transform(string str, out Dictionary<string, LinkDefinition> definitions)
{
if (EasyLineBreaks)
{
str = Regex.Replace(str, @"^([\w\*\>\<\[][^\r\n]*)(?=\r?\n[\w\*\>\<\[].*$)", "$1 ", RegexOptions.Multiline);
}

// Build blocks
var blocks = ProcessBlocks(str);

Expand Down Expand Up @@ -200,7 +206,11 @@ public string Transform(string str, out Dictionary<string, LinkDefinition> defin

// Done
return sb.ToString();
}
}

///<summary>Set to true to automatically have line breaks entered by the user converted into br tags without
/// needing double spaces</summary>
public bool EasyLineBreaks { get; set; }

public int SummaryLength
{
Expand Down
Loading