public static string ToTomboyXml(this string html_body) { var body = html_body.Replace ("<br>", "\n"); CQ html = body; html["b"].ReplaceOuterWithTag("<bold/>"); html["i"].ReplaceOuterWithTag ("<i/>"); html["ul"].ReplaceOuterWithTag ("<list/>"); html["li"].ReplaceOuterWithTag ("<list-item />"); html["h1"].ReplaceOuterWithTag ("<size:huge/>"); html["h2"].ReplaceOuterWithTag ("<size:large/>"); html["small"].ReplaceOuterWithTag ("<size:small/>"); html["strike"].ReplaceOuterWithTag ("<strikethrough/>"); html["pre"].ReplaceOuterWithTag ("<monospace/>"); html["a[class='internal']"].ReplaceOuterWithTag ("<link:internal/>"); html["a[class='url']"].ReplaceOuterWithTag ("<link:url/>"); html["a"].ReplaceOuterWithTag ("<link:url/>"); html["span[class='highlight']"].ReplaceOuterWithTag ("<highlight/>"); // hack replace <div> which get inserted by the wysihtml5 html["div"].Each (domobj => { CQ e = new CQ (domobj); var all = new CQ(e.Html()); e.ReplaceWith(all); }); var render = html.Render (); // maybe bug int tomboy - </list-items> need a single \n in from of them render = Regex.Replace (render, @"(?!\n)</list-item>", "\n</list-item>", RegexOptions.ExplicitCapture); return render; }