This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-nitride-cil/src/MfGames.Nitride.Markdown/IdentifyMarkdownFromPath.cs

29 lines
612 B
C#

using FluentValidation;
using MfGames.Gallium;
using Zio;
namespace MfGames.Nitride.Markdown;
public class IdentifyMarkdownFromPath : IdentifyMarkdown
{
public IdentifyMarkdownFromPath(IValidator<IdentifyMarkdown> validator)
: base(validator)
{
this.IsMarkdownTest = DefaultIsMarkdown;
}
private static bool DefaultIsMarkdown(
Entity entity,
UPath path)
{
return (path.GetExtensionWithDot() ?? string.Empty).ToLowerInvariant() switch
{
".md" => true,
".markdown" => true,
_ => false,
};
}
}