How to make ASP.NET WEB API HELP PAGES Xml Documentation Comments to have new line

烈酒焚心 提交于 2019-12-04 07:31:31
Lasse Christiansen

A similar question has been asked here: Web Api Help Page- don't escape html in xml documentation and the accepted answer (which is given by Kiran Challa - one of the ASP.NET Web API team members) describes a work around.

I just tried it myself, and it works fine.

However, instead of adding <br/> to my code comments, I changed the proposed solution from:

return node.InnerXml;

to:

return node.InnerXml.Replace("\r\n", "<br/>").Replace("\n", "<br/>");

... and as pointed out in the comments, there might be several places where you need to add @Html.Raw(), i.e., ApiGroup.cshtml, HelpPageApiModel.cshtml, and ResourceModel.cshtml and some of the partial views as well.

To figure out which views I had to change, I basically just launched the debugger in Chrome to help me inspect the html and locate the files to be changed based on that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!