using System;
using AngleSharp;
using AngleSharp.Html.Parser;
class MyClass {
static async Task Main() {
var config = Configuration.Default;
var context = BrowsingContext.New(config);
var source = "<h1>Some example source</h1><p>This is a paragraph element";
var document = await context.OpenAsync(req => req.Content(source));
Console.WriteLine("Serializing the (original) document:");
Console.WriteLine(document.DocumentElement.OuterHtml);
var p = document.CreateElement("p");
p.TextContent = "This is another paragraph.";
Console.WriteLine("Inserting another element in the body ...");
document.Body.AppendChild(p);
Console.WriteLine("Serializing the document again:");
Console.WriteLine(document.DocumentElement.OuterHtml);
}
}