-
Notifications
You must be signed in to change notification settings - Fork 884
Description
Is your feature request related to a problem? Please describe.
When using Custom filter rules and run docfx build command.
Following warnings occurred.
Unable to handle following files: filterConfig.yml. Do they miss
YamlMimeas the first line of file, e.g.:### YamlMime:ManagedReference?
I knows this warning can be suppressed by explicitly excluding filterConfig.yml from build configs.
But current message seems misleading to fix problem .
Describe the solution you'd like
filter parameter is not passed to SingleDocumentBuilder (Because it is used for docfx metadata command)
So it can't exclude by file path.
I thought, following changes are required to suppress warnings.
-
Add new
FilterConfigYAML mime type definition.
docfx/src/Microsoft.DocAsCode.Common/YamlMime.cs
Lines 10 to 13 in d295256
public const string YamlMimePrefix = nameof(YamlMime) + ":"; public const string ManagedReference = YamlMimePrefix + nameof(ManagedReference); public const string TableOfContent = YamlMimePrefix + nameof(TableOfContent); public const string XRefMap = YamlMimePrefix + nameof(XRefMap); -
Suppress warning occurred (by reading YAML mime)
docfx/src/Microsoft.DocAsCode.Build.Engine/SingleDocumentBuilder.cs
Lines 165 to 177 in 9fe315c
var notToHandleItems = files .Where(s => s.Key == null) .SelectMany(s => s) .Where(s => s.Type != DocumentType.Overwrite && !s.File.EndsWith(".yaml.md", StringComparison.OrdinalIgnoreCase) && !s.File.EndsWith(".yml.md", StringComparison.OrdinalIgnoreCase)) .ToList(); if (notToHandleItems.Count > 0) { Logger.LogWarning( $"Unable to handle following files: {notToHandleItems.Select(s => s.File).ToDelimitedString()}. Do they miss `YamlMime` as the first line of file, e.g.: `### YamlMime:ManagedReference`?", code: WarningCodes.Build.UnknownContentType); } -
Add YAML mime to filterConfig.yml file header.
### YamlMime:FilterConfig