diff --git a/README.md b/README.md
index 9939efe5b9..a1e3579e7a 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,6 @@ AppVeyor: [](https://travis-ci.org/aspnet/HtmlAbstractions)
-HTML abstractions used for building HTML content, including types such as `HtmlEncodedString` and `IHtmlContent`.
+HTML abstractions used for building HTML content, including types such as `HtmlString` and `IHtmlContent`.
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo.
diff --git a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilder.cs b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilder.cs
index be218244b0..864f3c8a65 100644
--- a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilder.cs
+++ b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilder.cs
@@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Html
{
if (!string.IsNullOrEmpty(encoded))
{
- Entries.Add(new HtmlEncodedString(encoded));
+ Entries.Add(new HtmlString(encoded));
}
return this;
diff --git a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilderExtensions.cs b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilderExtensions.cs
index f7474ca3f2..a5a83fdbb3 100644
--- a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlContentBuilderExtensions.cs
@@ -104,7 +104,7 @@ namespace Microsoft.AspNetCore.Html
throw new ArgumentNullException(nameof(builder));
}
- builder.AppendHtml(HtmlEncodedString.NewLine);
+ builder.AppendHtml(HtmlString.NewLine);
return builder;
}
@@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Html
}
builder.Append(unencoded);
- builder.AppendHtml(HtmlEncodedString.NewLine);
+ builder.AppendHtml(HtmlString.NewLine);
return builder;
}
@@ -141,7 +141,7 @@ namespace Microsoft.AspNetCore.Html
}
builder.AppendHtml(content);
- builder.AppendHtml(HtmlEncodedString.NewLine);
+ builder.AppendHtml(HtmlString.NewLine);
return builder;
}
@@ -160,7 +160,7 @@ namespace Microsoft.AspNetCore.Html
}
builder.AppendHtml(encoded);
- builder.AppendHtml(HtmlEncodedString.NewLine);
+ builder.AppendHtml(HtmlString.NewLine);
return builder;
}
diff --git a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlFormattableString.cs b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlFormattableString.cs
index 82e9b69d98..24bc7c5e2f 100644
--- a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlFormattableString.cs
+++ b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlFormattableString.cs
@@ -10,7 +10,7 @@ using System.Text.Encodings.Web;
namespace Microsoft.AspNetCore.Html
{
///
- /// An implementation of composite string formatting
+ /// An implementation of composite string formatting
/// (see https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110).aspx) which HTML encodes
/// formatted arguments.
///
@@ -107,9 +107,9 @@ namespace Microsoft.AspNetCore.Html
public string Format(string format, object arg, IFormatProvider formatProvider)
{
- // These are the cases we need to special case. We trust the HtmlEncodedString or IHtmlContent instance
+ // These are the cases we need to special case. We trust the HtmlString or IHtmlContent instance
// to do the right thing with encoding.
- var htmlString = arg as HtmlEncodedString;
+ var htmlString = arg as HtmlString;
if (htmlString != null)
{
return htmlString.ToString();
diff --git a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlEncodedString.cs b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlString.cs
similarity index 71%
rename from src/Microsoft.AspNetCore.Html.Abstractions/HtmlEncodedString.cs
rename to src/Microsoft.AspNetCore.Html.Abstractions/HtmlString.cs
index bf38ac3682..e7a516bd04 100644
--- a/src/Microsoft.AspNetCore.Html.Abstractions/HtmlEncodedString.cs
+++ b/src/Microsoft.AspNetCore.Html.Abstractions/HtmlString.cs
@@ -10,18 +10,23 @@ namespace Microsoft.AspNetCore.Html
///
/// An implementation that wraps an HTML encoded .
///
- public class HtmlEncodedString : IHtmlContent
+ public class HtmlString : IHtmlContent
{
///
- /// An instance for .
+ /// An instance for .
///
- public static readonly IHtmlContent NewLine = new HtmlEncodedString(Environment.NewLine);
+ public static readonly HtmlString NewLine = new HtmlString(Environment.NewLine);
///
- /// Creates a new .
+ /// An instance for .
+ ///
+ public static readonly HtmlString Empty = new HtmlString(string.Empty);
+
+ ///
+ /// Creates a new .
///
/// The HTML encoded value.
- public HtmlEncodedString(string value)
+ public HtmlString(string value)
{
Value = value;
}
diff --git a/src/Microsoft.AspNetCore.Html.Abstractions/project.json b/src/Microsoft.AspNetCore.Html.Abstractions/project.json
index d117f96abe..72763e5b05 100644
--- a/src/Microsoft.AspNetCore.Html.Abstractions/project.json
+++ b/src/Microsoft.AspNetCore.Html.Abstractions/project.json
@@ -1,6 +1,6 @@
{
"version": "1.0.0-*",
- "description": "ASP.NET Core HTML abstractions used for building HTML content.\r\nCommonly used types:\r\nMicrosoft.AspNetCore.Html.HtmlEncodedString\r\nMicrosoft.AspNetCore.Html.IHtmlContent",
+ "description": "ASP.NET Core HTML abstractions used for building HTML content.\r\nCommonly used types:\r\nMicrosoft.AspNetCore.Html.HtmlString\r\nMicrosoft.AspNetCore.Html.IHtmlContent",
"packOptions": {
"repository": {
"type": "git",
diff --git a/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs
index b985c51890..c14daeeebb 100644
--- a/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs
+++ b/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlContentBuilderExtensionsTest.cs
@@ -159,13 +159,13 @@ namespace Microsoft.AspNetCore.Html.Test
}
[Fact]
- public void Builder_AppendFormat_HtmlEncodedString()
+ public void Builder_AppendFormat_HtmlString()
{
// Arrange
var builder = new TestHtmlContentBuilder();
// Act
- builder.AppendFormat("{0}!", new HtmlEncodedString("First"));
+ builder.AppendFormat("{0}!", new HtmlString("First"));
// Assert
Assert.Equal("First!", HtmlContentToString(builder));
diff --git a/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlFormattableStringTest.cs b/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlFormattableStringTest.cs
index 6f466e6046..64e000751e 100644
--- a/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlFormattableStringTest.cs
+++ b/test/Microsoft.AspNetCore.Html.Abstractions.Test/HtmlFormattableStringTest.cs
@@ -54,10 +54,10 @@ namespace Microsoft.AspNetCore.Html
}
[Fact]
- public void HtmlFormattableString_WithHtmlEncodedString()
+ public void HtmlFormattableString_WithHtmlString()
{
// Arrange
- var formattableString = new HtmlFormattableString("{0}!", new HtmlEncodedString("First"));
+ var formattableString = new HtmlFormattableString("{0}!", new HtmlString("First"));
// Act
var result = HtmlContentToString(formattableString);
@@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Html
// Arrange
var formattableString = new HtmlFormattableString(
"Happy {0}, {1}!",
- new HtmlEncodedString("Birthday"),
+ new HtmlString("Birthday"),
new HtmlContentBuilder().Append("Billy"));
// Act
@@ -100,10 +100,10 @@ namespace Microsoft.AspNetCore.Html
}
[Fact]
- public void HtmlFormattableString_WithHtmlEncodedString_AndOffset()
+ public void HtmlFormattableString_WithHtmlString_AndOffset()
{
// Arrange
- var formattableString = new HtmlFormattableString("{0, 20}!", new HtmlEncodedString("First"));
+ var formattableString = new HtmlFormattableString("{0, 20}!", new HtmlString("First"));
// Act
var result = HtmlContentToString(formattableString);