How to customize the generated Markdown #114
Replies: 1 comment
-
This can be achieved by creating a plugin with a custom section for the public sealed class ParameterTitleSection : ISection
{
// important to use a new name so your implementation does not override the default Title section for the other types
public string Name => "ParameterTitle";
public void Write(IWriter writer)
{
if (writer.GetCurrentItem() is ParameterDocItem docItem)
{
if (!docItem.HasOwnPage(writer.Context))
{
string url = writer.Context.GetUrl(docItem);
int startIndex = url.IndexOf('#') + 1;
writer
.EnsureLineStartAndAppendLine()
.Append("<a name='")
.Append(url.Substring(startIndex, url.Length - startIndex))
.Append("'></a>");
}
// this is where you can customize what is written
writer
.EnsureLineStartAndAppendLine();
.Append($"`{docItem.Name}` ")
.AppendLink(docItem, parameterItem.Parameter.Type)
}
}
} All that's left then is to tell in your configuration to use this section in your configuration: {
...
"ParameterDocItem": {
"Sections": [
"Header",
"ParameterTitle",
"Summary",
"Example",
"Remarks",
"SeeAlso"
]
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Apologies if the answer is already documented and I am just missing it.
In the generated documentation for a particular method, I am getting two lines of text for each parameter (as seen below). I would like to be able to more clearly delineate between each parameter, either by changing the formatting of the parameter's name, or adding lines between each set, or something else (examples below the initial screenshot). Any thoughts on the easiest way to do this?
Example Idea 1:
code
to boldExample Idea 2:
<hr width="95%" style="background-color: #000000;" />
Beta Was this translation helpful? Give feedback.
All reactions