You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm already using PostProcessors, and probably I could make it work with these alone. But I would rather understand how to influence the whole docfx templating chain. My goal is to add a custom tag to my API method documentation, so something like this (note the print tag):
/// <summary>/// Doesn't do much/// </summary>/// <print>true</print>publicvoidMyMethod(){returnnull;}
If this print tag is set to true, the method's source code should be printed to the documentation.
How would you go about this? Am I more or less on the right track with the following?
How I can access a custom tag in the FileViewModel/PageViewModel I receive in my IDocumentBuildStep (see below)?
How can I pass information from the IDocumentBuildStep to the preprocessor/renderer?
I've tried to add a IDocumentBuildStep to the ManagedReferenceDocumentProcessor as an approximation:
publicoverrideIEnumerable<FileModel>Prebuild(ImmutableList<FileModel>models,IHostServicehost){foreach(varmodelinmodels){// if (((dynamic)model.Content).Items[0].Tags["print"] == true) { // how can I access a "custom" tag on my API method?varsrc=((dynamic)model.Content).Items[0].Source;// Content is PageViewModel, Content.Items[0] is ItemsViewModelif(src!=null){varfilePath=src.Path;varstartingLineNumber=src.StartLine;varmethodCode=ExtractMethodSourceCode(filePath,startingLineNumber);// uses Roslyn to get method body (works)model.Properties.SourceCode=methodCode;// where can I store the source code, so I can access it later in the JS preprocessor or Razor renderer?}}returnbase.Prebuild(models,host);}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm already using PostProcessors, and probably I could make it work with these alone. But I would rather understand how to influence the whole docfx templating chain. My goal is to add a custom tag to my API method documentation, so something like this (note the print tag):
If this print tag is set to true, the method's source code should be printed to the documentation.
How would you go about this? Am I more or less on the right track with the following?
I've tried to add a IDocumentBuildStep to the ManagedReferenceDocumentProcessor as an approximation:
[Export("ManagedReferenceDocumentProcessor", typeof(IDocumentBuildStep))]
Beta Was this translation helpful? Give feedback.
All reactions