Wyam is a highly modular and extremely configurable static content generator and toolkit.
It can be used for all sorts of things like creating a blog, but one of cool things it can do is build some awesome API documentation for your C# code.
So if you are in the market for generating API docs, check this out.
- You can download a self contained zip file that has the Wyam.exe
- Download the Setup.exe installer
Note: You may also need to right-click the zip file after download and select “Unblock” in the Security section of the properties dialog, otherwise you could get strange errors when using the application.
For this demo I’m going with the zip file. Simply unzip and call the Wyam.exe CLI from PowerShell.
> .\Wyam.exe help
By convention, we can put our source code for our project we want to create API docs for in the
I cloned the Nancy repo into the src folder so we can generate API docs for it.
From the screenshot above, we can tell from the help options that we can call the Wyam CLI with a “new” command. In order to generate docs, we can call.
> .\Wyam.exe new -r docs
-r docs argument is to specify that we are using the “docs” recipe. As mentioned you can also create other types of static content such as a blog using the blog recipe.
We’re ready to build our static API docs already. I know, not much setup required!
> .\Wyam.exe build
This process may take some time to build all the fields depending on the size of your project.
You should now have an output/ directory that contains all of your static content (html files) for your docs.
Preview with Built-in Webserver
Now this feature is pretty cool. You can preview and use your browser to view your docs by using the preview command.
> .\Wyam.exe preview
Now if we head over to our browser and head over to http://localhost:5080 we get our awesome looking API docs!
There is a ton you can do with Wyam. One aspect I find really interesting is being able to embed with the NuGet package Wyam.Core. I plan on exploring that option more and will likely have more posts about Wyam soon.
Are you using a static site generator for API docs? If so, I’d love to hear your comments below or via Twitter