ktsu.Frontmatter
1.4.6
Prefix Reserved
See the version list below for details.
dotnet add package ktsu.Frontmatter --version 1.4.6
NuGet\Install-Package ktsu.Frontmatter -Version 1.4.6
<PackageReference Include="ktsu.Frontmatter" Version="1.4.6" />
<PackageVersion Include="ktsu.Frontmatter" Version="1.4.6" />
<PackageReference Include="ktsu.Frontmatter" />
paket add ktsu.Frontmatter --version 1.4.6
#r "nuget: ktsu.Frontmatter, 1.4.6"
#:package ktsu.Frontmatter@1.4.6
#addin nuget:?package=ktsu.Frontmatter&version=1.4.6
#tool nuget:?package=ktsu.Frontmatter&version=1.4.6
ktsu.Frontmatter
A .NET library for processing and manipulating YAML frontmatter in markdown files.
Features
- Extract, add, replace, and remove frontmatter from markdown documents
- Combine multiple frontmatter sections into a single section
- Standardize property names using intelligent matching
- Sort properties according to standard conventions
- Merge similar properties using different strategies
- High performance with caching for repeated operations
Installation
dotnet add package ktsu.Frontmatter
Usage
using ktsu.Frontmatter;
// Extract frontmatter from a markdown document
string markdown = File.ReadAllText("document.md");
var frontmatter = Frontmatter.ExtractFrontmatter(markdown);
// Add frontmatter to a document
var properties = new Dictionary<string, object>
{
{ "title", "My Document" },
{ "date", DateTime.Now },
{ "tags", new[] { "documentation", "markdown" } }
};
string withFrontmatter = Frontmatter.AddFrontmatter(markdown, properties);
// Replace frontmatter
string replaced = Frontmatter.ReplaceFrontmatter(markdown, properties);
// Remove frontmatter
string withoutFrontmatter = Frontmatter.RemoveFrontmatter(markdown);
// Combine multiple frontmatter sections
string combined = Frontmatter.CombineFrontmatter(markdown);
// Customize property naming and ordering
string customized = Frontmatter.CombineFrontmatter(
markdown,
FrontmatterNaming.Standard, // Standardize property names
FrontmatterOrder.Sorted, // Sort properties in standard order
FrontmatterMergeStrategy.Conservative // Merge similar properties
);
// Extract just the document body (content after frontmatter)
string body = Frontmatter.ExtractBody(markdown);
Advanced Features
Property Naming
Control how property names are handled:
FrontmatterNaming.AsIs: Keep property names as-isFrontmatterNaming.Standard: Standardize property names using common conventions
Property Ordering
Control how properties are ordered:
FrontmatterOrder.AsIs: Keep properties in the order they appearFrontmatterOrder.Sorted: Sort properties according to standard conventions
Merge Strategies
Control how similar properties are merged:
FrontmatterMergeStrategy.None: Do not merge any propertiesFrontmatterMergeStrategy.Conservative: Only merge properties using predefined mappingsFrontmatterMergeStrategy.Aggressive: Merge properties using basic pattern matchingFrontmatterMergeStrategy.Maximum: Merge properties using semantic analysis
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. 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. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ktsu.Extensions (>= 1.9.3)
- ktsu.FuzzySearch (>= 1.4.3)
- System.Memory (>= 4.6.3)
- System.Threading.Tasks.Extensions (>= 4.6.3)
- YamlDotNet (>= 18.1.0)
-
.NETStandard 2.1
- ktsu.Extensions (>= 1.9.3)
- ktsu.FuzzySearch (>= 1.4.3)
- YamlDotNet (>= 18.1.0)
-
net10.0
- ktsu.Extensions (>= 1.9.3)
- ktsu.FuzzySearch (>= 1.4.3)
- YamlDotNet (>= 18.1.0)
-
net8.0
- ktsu.Extensions (>= 1.9.3)
- ktsu.FuzzySearch (>= 1.4.3)
- YamlDotNet (>= 18.1.0)
-
net9.0
- ktsu.Extensions (>= 1.9.3)
- ktsu.FuzzySearch (>= 1.4.3)
- YamlDotNet (>= 18.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ktsu.Frontmatter:
| Package | Downloads |
|---|---|
|
ktsu.KtsuTools.Markdown
KtsuTools is a unified developer tools suite that consolidates multiple ktsu-dev utilities into a single CLI application with consistent UX powered by Spectre.Console. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.4.8-pre.2 | 68 | 11/23/2026 |
| 1.4.8-pre.1 | 70 | 11/16/2026 |
| 1.4.7 | 180 | 11/14/2026 |
| 1.4.6 | 104 | 11/13/2026 |
| 1.4.5 | 348 | 10/9/2026 |
| 1.4.5-pre.2 | 89 | 10/8/2026 |
| 1.4.5-pre.1 | 89 | 10/7/2026 |
| 1.4.4 | 176 | 10/7/2026 |
| 1.4.3 | 123 | 10/6/2026 |
| 1.4.2 | 122 | 10/6/2026 |
| 1.4.1 | 134 | 10/6/2026 |
| 1.4.1-pre.2 | 76 | 10/5/2026 |
| 1.4.1-pre.1 | 90 | 9/30/2026 |
| 1.4.0 | 1,160 | 9/30/2026 |
| 1.3.4 | 137 | 9/29/2026 |
| 1.3.3 | 136 | 9/29/2026 |
| 1.3.3-pre.1 | 79 | 9/28/2026 |
| 1.3.2 | 141 | 9/28/2026 |
| 1.3.1 | 165 | 9/27/2026 |
| 1.3.0 | 144 | 9/26/2026 |
## v1.4.6 (patch)
Changes since v1.4.5:
- Keep a header's untouched nested values as written when the caller edits their mapping or list [patch] (#253) (matt-edmondson)
- Suppress Polyfill shim drift in package validation [patch] (#256) (matt-edmondson)
- Write Int128, UInt128, Half, BigInteger, nint and nuint as one scalar [patch] (#238) (matt-edmondson)
- Keep a string the header wrote quoted quoted when the header is rewritten [patch] (#240) (matt-edmondson)
- Write System.Text.Json values as the values they hold [patch] (#244) (matt-edmondson)
- Read a header that holds a YAML tag, and keep the tag on rebuild [patch] (#245) (matt-edmondson)
- Quote a TimeSpan and keep a dot in an exponent double's mantissa [patch] (#246) (matt-edmondson)
- Write a value passed under two keys in full, not as a YAML alias [patch] (#248) (matt-edmondson)
- Keep values a header already holds as written when the header is rewritten [patch] (#237) (matt-edmondson)
- Insert a double or decimal into the header without dropping its comments [patch] (#236) (matt-edmondson)
- Resolve only a plain \<\< as a YAML merge key [patch] (#232) (matt-edmondson)
- Quote caller strings that read back as floats, = or \<\< [patch] (#231) (matt-edmondson)
- Keep keys in input order when CombineFrontmatter merges them [patch] (#227) (matt-edmondson)
- Give the caller-value serializer the invariant scalar converter [patch] (#226) (matt-edmondson)
- Keep a body that opens with a rule passage out of the header in RemoveFrontmatter [patch] (matt-edmondson)
- Drop the converter's unused read path to meet SonarCloud's new-code coverage gate (Claude)
- Split ResolveMergeKeys and assert booleans directly, per SonarCloud (Claude)
- Write DateTimeOffset, DateOnly, TimeOnly and Version values as one scalar [patch] (Claude)
- Resolve YAML merge keys instead of returning a literal "\<\<" property [patch] (Claude)
- Merge remote-tracking branch 'origin/main' into fix/188-quote-yaml11-lookalikes (matt-edmondson)
- Quote caller strings that YAML 1.1 reads as booleans or numbers [patch] (Claude)
- Keep the header as written when AddFrontmatter adds no new key [patch] (Claude)
- Write the body after an inserted key as a rebuilt header writes it (Claude)
- Merge main into fix/170-add-keeps-header-text (Claude)
- Drop a null check the parse already rules out, and use AreSequenceEqual (Claude)
- Filter the added keys with Where in TryInsertIntoHeader (Claude)
- Insert added keys into the header instead of rebuilding it [patch] (Claude)
- Keep the blank line that sets a body rule apart from the header [patch] (Claude)
- Report a block with a complex key as unreadable [patch] (Claude)
- Fold IsEmptyYamlDocument's three catches into one filtered catch (Claude)
- Treat a header with no keys as empty so AddFrontmatter fills it [patch] (Claude)
- Double-quote strings holding a carriage return or NEL so they round-trip [patch] (Claude)