private static void ParseText(HtmlNode htmlNode, ref List <Elements.BaseElement> elements, double fontSizeMultiplier, FontStyle fontStyle, FontWeight fontWeight, TextDecorationCollection textDecorations, Brush foreground) { string decodedText = DecodeText(htmlNode.InnerText); decodedText = decodedText.Trim(); if (String.IsNullOrEmpty(decodedText) && elements.Count > 0 && elements[elements.Count - 1] is Elements.Break) // we don't add empty space after break { return; } // create text Elements.BaseElement element = new Elements.Text() { FontSizeMultiplier = fontSizeMultiplier, FontStyle = fontStyle.ToTextFontStyle(), FontWeight = fontWeight.ToTextFontWeight(), Decoration = textDecorations.ToTextDecoration(), Foreground = foreground, Value = decodedText }; // extract id ExtractId(htmlNode, ref element); // extract anchor if (htmlNode.Name == "a") { ExtractHref(htmlNode, ref element); } // add elements.Add(element); }