Convert plain text to HTML C#
public static string ToHtml(this string s, bool nofollow)
{
    s = HttpUtility.HtmlEncode(s);
    string[] paragraphs = s.Split(new string[]{"\r\n\r\n"}, StringSplitOptions.None);
    StringBuilder sb = new StringBuilder();
    foreach (string par in paragraphs) {
        sb.AppendLine("&lt;p&gt;");
        string p = par.Replace(Environment.NewLine, "&lt;br /&gt;\r\n");
        if (nofollow) {
            p = Regex.Replace(p, @"\[\[(.+)\]\[(.+)\]\]", "&lt;a href=\"$2\" rel=\"nofollow\"&gt;$1&lt;/a&gt;");
            p = Regex.Replace(p, @"\[\[(.+)\]\]", "&lt;a href=\"$1\" rel=\"nofollow\"&gt;$1&lt;/a&gt;");
        } else {
            p = Regex.Replace(p, @"\[\[(.+)\]\[(.+)\]\]", "&lt;a href=\"$2\"&gt;$1&lt;/a&gt;");
            p = Regex.Replace(p, @"\[\[(.+)\]\]", "&lt;a href=\"$1\"&gt;$1&lt;/a&gt;");
            sb.AppendLine(p);
        }
        sb.AppendLine("&lt;/p&gt;");
    }
    return sb.ToString();
}


In general, if you find yourself with a variable that you pass around through a bunch of static methods (like nofollow), it may be time to make those methods not static.