Proposal: merge mode specified in override file #9908
Replies: 3 comments
-
There is a |
Beta Was this translation helpful? Give feedback.
-
What if there are two properties to override where one wants |
Beta Was this translation helpful? Give feedback.
-
In the header of an overwrite file, there is the name of the property, so the placement is specified for this property: ---
uid: namespace.class.member
remarks: *content
placement: after
--- |
Beta Was this translation helpful? Give feedback.
-
The problem
Sometimes, I need to add documentation after the remarks for a class (or a member). Currently, when creating an override file for the remarks, docfx just replaces the remarks with the override content.
A solution
The yaml header for an override has currently the following format:
We can add a new parameter in this header, in the following form
placement: <value>
. Wherevalue
can beafter
,before
orreplace
.If the parameter is defined and the value is one of the three valid ones, the content is updated accordingly. Otherwise, the old merge algorithm is used, so there is no breaking change in existing documentation.
To do
Docfx.Common
, define aIModelWithMetada
interface, for a single property:Metadata
, of typeDictionary<string, object>
.Docfx.Dotnet.ItemViewModel
implementsIModelWithMetadata
(it already define the property).Docfx.Common.ReflectionEntityMerger.Merge
, detect and manage the parameter.I already have a working version, but it needs to be polished. Before I finish and make a pull request, I would like to know what you think of this solution.
PS: English is not my mother tongue, so, if you have better names, please tell me. Also, excuse the English errors.
Beta Was this translation helpful? Give feedback.
All reactions