Skip to content

Commit ba315c5

Browse files
committed
Improved infrastructure, prepare for 0.13
1 parent 5a3a704 commit ba315c5

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
(tbd)
44

5-
-
5+
- Added `ToXml` and `ToMarkup` extensions for the formatting
66

77
# 0.12.1
88

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace AngleSharp.Xml
2+
{
3+
using System;
4+
5+
/// <summary>
6+
/// Extensions for the markup formattable elements.
7+
/// </summary>
8+
public static class MarkupFormatterExtensions
9+
{
10+
/// <summary>
11+
/// Returns the serialization of the object model guided by the
12+
/// XML markup formatter.
13+
/// </summary>
14+
/// <param name="markup">The markup to serialize.</param>
15+
/// <returns>The source code snippet.</returns>
16+
public static String ToXml(this IMarkupFormattable markup) =>
17+
markup.ToHtml(XmlMarkupFormatter.Instance);
18+
19+
/// <summary>
20+
/// Returns the serialization of the object model guided by the
21+
/// auto selected (XML, XHTML, HTML) markup formatter.
22+
/// </summary>
23+
/// <param name="markup">The markup to serialize.</param>
24+
/// <returns>The source code snippet.</returns>
25+
public static String ToMarkup(this IMarkupFormattable markup) =>
26+
markup.ToHtml(new AutoSelectedMarkupFormatter());
27+
}
28+
}

0 commit comments

Comments
 (0)