public void Split_ShouldSplit_OnUnderscore2() { var handler = new EmHandler(); var markdown = "ab _abs __fr__ e_ de"; var result = new[] { "ab ", "_abs __fr__ e_", " de" }; handler.Split(markdown) .ShouldBeEquivalentTo(result); }
public string RenderToHtml(string markdown) { var emHandler = new EmHandler(); var strongHandler = new StrongHandler(); var splitedLine = emHandler.Split(markdown); var html = splitedLine.Select(line => { if (line.StartsWith("_") && line.EndsWith("_")) { var emHtml = "<em>" + line.Trim('_') + "</em>"; return(emHandler.RemoveScreening(emHtml)); } return(strongHandler.Handle(line)); }).ToArray(); return(String.Join("", html)); }