Closed mingwli closed 5 years ago
Hey,
Yeah I agree this is a good idea allowing a custom encode method to be provided and fallback to the WebUtility.HtmlEncode
function.
If you'd like to contribute the functionality I'd be happy to help with the design
I've just merged this into master. I'll leave it a few days to see if I can fit anything else into the next release.
Thanks for your suggestion and using the library!
Thank you for your contribution @mingwli. This has now been released on to nuget in v1.4.14.
Please let me know if you have any issues and thank you for using Stubble.
One can provide a custom encode method in this way (here I am setting it to HttpUtility.HtmlAttributeEncode
):
var stubble = new StubbleBuilder()
.Configure(builder => builder.SetEncodingFunction((str) => System.Web.HttpUtility.HtmlAttributeEncode(str)))
.Build();
Just writing it down for the next person coming along.
Instead of using
WebUtility.HtmlEncode
, is it possible to support customized html encode method?