FlipLeaf.Engine
1.0.0-alpha-15
This is a prerelease version of FlipLeaf.Engine.
dotnet add package FlipLeaf.Engine --version 1.0.0-alpha-15
NuGet\Install-Package FlipLeaf.Engine -Version 1.0.0-alpha-15
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FlipLeaf.Engine" Version="1.0.0-alpha-15" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FlipLeaf.Engine --version 1.0.0-alpha-15
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FlipLeaf.Engine, 1.0.0-alpha-15"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FlipLeaf.Engine as a Cake Addin #addin nuget:?package=FlipLeaf.Engine&version=1.0.0-alpha-15&prerelease // Install FlipLeaf.Engine as a Cake Tool #tool nuget:?package=FlipLeaf.Engine&version=1.0.0-alpha-15&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FlipLeaf.Engine
Early version; still a prototype.
FlipLeaf is a(nother) static source generator for .NET.
This engine allows you to create a new console app and generate a new site using these commands:
dotnet new console
dotnet add package FlipLeaf.Engine --version 1.0.0-alpha-10
You can create a index.md
file in a "content" directory,
Then edit the Program.cs file to set this content:
using Microsoft.Extensions.DependencyInjection;
using System.Xml.Linq;
Console.OutputEncoding = System.Text.Encoding.UTF8; // required for emoticons
var builder = SiteBuilder.CreateDefault(args);
builder
.AddYaml()
.AddLiquid()
.AddMarkdown();
var site = builder.Build();
// markdown rendering
site.AddToPipeline(async static (ISite s, Leaf input) =>
{
if (input.Extension != ".md") return input.FlipToNothing();
// dependencies
var yaml = s.Services.GetRequiredService<IYamlMarkup>();
var liquid = s.Services.GetRequiredService<ILiquidMarkup>();
var md = s.Services.GetRequiredService<IMarkdownMarkup>();
// render
var content = input.ReadAllText();
(content, var headers) = yaml.ParseHeader(content);
(content, var context) = await liquid.RenderAsync(content, headers);
content = md.Render(content, input);
content = await liquid.ApplyLayoutAsync(content, context);
// write output
return input.FlipToContent(content, Path.GetFileNameWithoutExtension(input.Name) + ".html");
});
// default action: copy file as-is
site.AddToPipeline(static x => x.FlipToCopy());
// generate sitemap.xml
site.AddPostProcess(static s =>
{
var ns = (XNamespace)"http://www.sitemaps.org/schemas/sitemap/0.9";
new XElement(ns + "urlset",
s.Content.Where(i => i.OutName.EndsWith(".html")).Select(i => new XElement(ns + "url",
new XElement(ns + "loc", "https://coldwire.net/" + i.OutName)))
).Save(Path.Combine(s.OutDir, "sitemap.xml"));
});
// TODO : generate rss
// RUN !
Console.WriteLine($"🍃 Starting on {site.RootDir}");
await site.RunAsync(args);
Your website will be generated in the "out" directory.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- ColorCode.HTML (>= 2.0.15)
- CsharpToColouredHTML.Core (>= 1.0.44)
- Fluid.Core (>= 2.17.0)
- Markdig (>= 0.39.1)
- Microsoft.Extensions.Caching.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Caching.Memory (>= 9.0.0)
- Microsoft.Extensions.Hosting (>= 9.0.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Text.Encodings.Web (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
- YamlDotNet (>= 16.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-alpha-15 | 30 | 1/31/2025 |
1.0.0-alpha-14 | 33 | 1/31/2025 |
1.0.0-alpha-13 | 617 | 7/26/2018 |
1.0.0-alpha-12 | 607 | 7/26/2018 |
1.0.0-alpha-11 | 617 | 7/26/2018 |
1.0.0-alpha-10 | 32 | 1/31/2025 |