I want to specify custom /// tag (ex. EcsComponent) that will be added to generated .yml file. And later render some additional info (link to external site) for marked classes. Are the any way to do it? I see some examples of plugins for processing .yml files, but nothing about metadata generation plugins.
Asked
Active
Viewed 105 times
2 Answers
0
You can use a preprocessor and a custom template for this.
The function in templates/yourTemplate/ManagedReference.extension.js
would look like this
exports.postTransform = function (model) {
transformModel(model);
return model;
}
function transformModel(child) {
if(child.children !== undefined) {
for (let i = 0; i < child.children.length; i++) { //iterate through every child of the model (if you want to go troughg methods, properties, etc..
transformModel(child.children[i]);
for (let j = 0; j < fields.length; j++)
{
if (child.children[i].summary && child.children[i].summary.indexOf("<"+ TAG_NAME + ">") !== -1) {
child.children[i]["FIELD_NAME"] = "VALUE"; //value will be set into the model
}
}
}
}
Then you can render it in templates/yourTemplate/partials/class.tmpl.partial
like this for example:
...
<h5 class="decalaration">{{__global.declaration}}</h5>
...
{{FIELD_NAME}}
...
Don't forget to add template to docfx.json
"template": [
"default",
"templates/yourTemplate"
],

Maarty
- 1,140
- 1
- 12
- 27