Skip to content

Commit bcf51cc

Browse files
Add a new option
1 parent 77ae081 commit bcf51cc

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/HtmlAgilityPack.Shared/HtmlDocument.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ public static bool DisableBehaviorTagP
224224
/// </summary>
225225
public int OptionMaxNestedChildNodes = 0;
226226

227+
/// <summary>
228+
/// Enable to create a "new line" for tag such as "br"
229+
/// </summary>
230+
public bool OptionEnableBreakLineForInnerText;
231+
227232

228233
#endregion
229234

src/HtmlAgilityPack.Shared/HtmlNode.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,12 @@ internal virtual void InternalInnerText(StringBuilder sb, bool isDisplayScriptin
421421
return;
422422
}
423423

424+
if (_ownerdocument.OptionEnableBreakLineForInnerText && Name == "br")
425+
{
426+
sb.AppendLine();
427+
return;
428+
}
429+
424430
if (_nodetype == HtmlNodeType.Text)
425431
{
426432
sb.Append(((HtmlTextNode) this).Text);

0 commit comments

Comments
 (0)