How to format/style ///<summary> in Web API 2

355 Views Asked by At

Maybe this isn't even possible, but it seems silly that I can't figure it out (nor can find anything conclusive after searching).

With a MVC/C# Web API 2 project, your controllers can be documented using something like:

///<summary>
///This is something really cool that you should use.  I want <b>this bold</b>.
///</summary>
[HttpPost]
public MyResponse MyMethod(SomeInput input)
{
....
}

When the API runs, the project automatically builds the help site, and I can see the above endpoint/method, and its description ( text), but I've head to figure out how to do any sort of styling to the summary. It appears that the HTML tags get striped from the help page's output. Notice in my example above, I have "this bold". I'm not so much concerned about bold, but more interested in being able to use unordered lists () and other basic HTML tags to just do some real basic formatting.

Is this even possible? Is there a trick to it? Is there some other markup/formatting I should be using?

Note - The actual endpoint that I'm trying to document at moment, happens to be a mime multipart form, and the framework won't document those out of the box. To get around this, I've created some helper methods in HelpPageConfigurationExtensions (to determine if the current endpoint view is one that requires custom documentation), in HelpPageApiModel.cshtml to determine if it should show the stock documentation or the custom docs, a helper library that contains the custom doc information, and a series of help functions that use some reflection to rapidly build HTML tables for the rest of the help page's documentation (e.g. the request and response objs). I'm mentioning this because maybe I just need to further extend my custom doc library to include (hard code) the value, and then in the view I can just @Html.Raw it -- opposed to trying to get the actual method's to output with formatting.

Thoughts? Thanks!

0

There are 0 best solutions below