0
J'ai un lecteur de code couleur html qui prend en html (sous forme de chaîne) comme celle-ci:C# - Annexer code couleur avant balises HTML
var str = @"<html><head><title> HTML highlight test page </title> </head> <body> This is text in the body.<br><h1> This is a heading </h1><p> This is a paragraph.</p> There is more text in the body after the paragraph. <p> So is this.</p> </body> </html>";
Je voudrais par exemple, prendre toutes les <p>
balises et ajouter à \color[DARKGRAY]
il
<p>This is a paragraph.</p>
à
\color[DARKGRAY]<p>This is a paragraph.</p>
Je le pack d'agilité HTML comme ceci
var html = doc.DocumentNode.SelectNodes("//p");
if (html != null)
{
foreach (HtmlAgilityPack.HtmlNode item in html)
{
item.Name = "\color[RED]<p>";
}
}
Mais c'est vraiment faux. Comment puis-je réaliser l'append?