Closed cjsha closed 3 weeks ago
After input from the docfx people, I can pull custom attributes into the metadata. They were getting excluded because docfx's default filter excludes attributes define in System.ComponentModel
namespace. This can be fixed by manually including the attributes we want to use in the docs in the filter.yml
like this:
attributeRules:
- include: # this is necessary to pull our custom attributes into .yml metadata without disabling the docfx default filter
uidRegex: ^System\.ComponentModel\.(CategoryAttribute|DescriptionAttribute)$
type: Type
An alternative would be defining these attributes in another namespace, if possible. For example, it seems that the [Range(min, max)]
attribute is defined in the Bonsai namespace so it wasn't getting filtered out. I don't know enough about attributes in C# to know if this is worth considering. In any case, I doubt it because we should mold the docs around the code and not the other way around.
Below is an example of a metadata file that is generated by including the above lines in the filter.yml
file. Here you can see what I'm talking about regarding the attribute namespace. Ctrl+F the file for "attributes:" I attached a zip file because github doesn't allow attaching .yml files.
OpenEphys.Onix1.ConfigureHeartbeat.zip
This is a good one to discuss in our next technical meeting.
This needs to fix so that I can categorize properties into "Configuration Property" or "Acquisition Property" categories.
For example:
[Range(0, 1000000)]
is pulled into syntax.content forBeatsPerSecond
[Category(ConfigurationCategory)]
&[Description(<whatever>)]
are not pulled into syntax.content for eitherBeatsPerSecond
orEnable
The relevant files for this example are: OpenEphys.Onix.ConfigureHeartbeart.yml (generated locally by
docfx metadata
command) and ConfigureHeartbeart.cs