I have a rest api developed using ASP.NET WEB API. I used help pages nuget package in order to create documentation. One problem I encountered is the following. For my model objects, I have xml documentation comments and they become descriptions on the help pages for each member of the model. I want certain part of the description to be on a new line, but everything in the comment comes as one paragraph. I tried to add <br/>
in the comments, but didn't help. Does anyone know how to achieve this?
相关问题
- Register MicroServices in Azure Active Directory (
- PromptDialog Choice with List object Bot Framework
- Dotnet Core API - Get the URL of a controller meth
- Serving data with “transfer-encoding: chunked” on
- StringEnumConverter invalid int values
相关文章
- POSTing data to WebApi after update to 5.1.0 fails
- Can you use generic methods in a controller?
- Remove a route with IOperationFilter in SwashBuckl
- Validate fails in unit tests
- subdomain CORS in webApi 2
- Post Array Json to .net core web api controller [d
- How can I read JSON from a StringContent object in
- Add claims with Owin Middleware
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
, andResourceModel.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.