ktsu.Frontmatter 1.2.3

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-is
  • FrontmatterNaming.Standard: Standardize property names using common conventions

Property Ordering

Control how properties are ordered:

  • FrontmatterOrder.AsIs: Keep properties in the order they appear
  • FrontmatterOrder.Sorted: Sort properties according to standard conventions

Merge Strategies

Control how similar properties are merged:

  • FrontmatterMergeStrategy.None: Do not merge any properties
  • FrontmatterMergeStrategy.Conservative: Only merge properties using predefined mappings
  • FrontmatterMergeStrategy.Aggressive: Merge properties using basic pattern matching
  • FrontmatterMergeStrategy.Maximum: Merge properties using semantic analysis

License

MIT

No packages depend on ktsu.Frontmatter.

## v1.2.3 (patch) Changes since v1.2.2: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync .github\workflows\dotnet.yml ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the microsoft group with 2 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the microsoft group with 2 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) - Bump MSTest.Sdk from 4.0.2 to 4.1.0 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Bump Polyfill from 9.7.7 to 9.8.1 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the ktsu group with 1 update ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the ktsu group with 5 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.3-pre.12 (prerelease) Changes since v1.2.3-pre.11: - Bump the microsoft group with 2 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.3-pre.11 (prerelease) Changes since v1.2.3-pre.10: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.3-pre.10 (prerelease) Changes since v1.2.3-pre.9: - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Bump the microsoft group with 2 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.3-pre.9 (prerelease) Changes since v1.2.3-pre.8: - Bump MSTest.Sdk from 4.0.2 to 4.1.0 ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.3-pre.8 (prerelease) Changes since v1.2.3-pre.7: - Bump Polyfill from 9.7.7 to 9.8.1 ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.3-pre.7 (prerelease) Changes since v1.2.3-pre.6: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.3-pre.6 (prerelease) Changes since v1.2.3-pre.5: - Bump the ktsu group with 1 update ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.3-pre.5 (prerelease) Changes since v1.2.3-pre.4: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.3-pre.4 (prerelease) Changes since v1.2.3-pre.3: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.3-pre.3 (prerelease) Changes since v1.2.3-pre.2: - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync scripts\PSBuild.psm1 ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.3-pre.2 (prerelease) Changes since v1.2.3-pre.1: - Sync scripts\update-winget-manifests.ps1 ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync COPYRIGHT.md ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.3-pre.1 (prerelease) Changes since v1.2.2: - Bump the ktsu group with 5 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.2 (patch) Changes since v1.2.1: - Remove .github\workflows\project.yml ([@matt-edmondson](https://github.com/matt-edmondson)) - Bump Polyfill from 9.7.6 to 9.7.7 ([@dependabot[bot]](https://github.com/dependabot[bot])) - Bump the ktsu group with 5 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) - Merge remote-tracking branch 'refs/remotes/origin/main' ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync global.json ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync .github\workflows\dotnet.yml ([@ktsu[bot]](https://github.com/ktsu[bot])) - Sync .gitignore ([@ktsu[bot]](https://github.com/ktsu[bot])) ## v1.2.2-pre.3 (prerelease) Changes since v1.2.2-pre.2: - Bump Polyfill from 9.7.6 to 9.7.7 ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.2-pre.2 (prerelease) Changes since v1.2.2-pre.1: - Bump the ktsu group with 5 updates ([@dependabot[bot]](https://github.com/dependabot[bot])) ## v1.2.2-pre.1 (prerelease) No significant changes detected since v1.2.2. ## v1.2.1 (patch) Changes since v1.2.0: - Migrate to dotnet 10 ([@matt-edmondson](https://github.com/matt-edmondson)) - Update project configuration and scripts for improved build processes ([@matt-edmondson](https://github.com/matt-edmondson)) - Update configuration files and scripts for improved build and test processes ([@matt-edmondson](https://github.com/matt-edmondson)) - Remove obsolete build configuration files and scripts ([@matt-edmondson](https://github.com/matt-edmondson)) - Update project SDK references in Frontmatter and Frontmatter.Test ([@matt-edmondson](https://github.com/matt-edmondson)) - Enhance Frontmatter validation and refactor PropertyMerger logic ([@matt-edmondson](https://github.com/matt-edmondson)) - Enhance Frontmatter and PropertyMerger functionality ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor YamlSerializer for improved deserialization and serialization ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor YamlSerializer for improved deserialization and serialization ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor Frontmatter extraction and PropertyMerger logic ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor NameStandardizer and PropertyMerger for improved property mapping ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor PropertyMerger and YamlSerializer for improved performance and reliability ([@matt-edmondson](https://github.com/matt-edmondson)) - Enhance PropertyMerger and YamlSerializer functionality ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor Frontmatter and PropertyMerger logic ([@matt-edmondson](https://github.com/matt-edmondson)) - Refactor Frontmatter extraction and standardization logic ([@matt-edmondson](https://github.com/matt-edmondson)) - Add additional unit tests for Frontmatter functionality ([@matt-edmondson](https://github.com/matt-edmondson)) - Add comprehensive unit tests for Frontmatter handling ([@matt-edmondson](https://github.com/matt-edmondson)) - Remove obsolete test methods from PropertyMergerTests ([@matt-edmondson](https://github.com/matt-edmondson)) - Add unit tests for PropertyMerger's similarity mapping ([@matt-edmondson](https://github.com/matt-edmondson)) - Remove obsolete test files for PropertyMerger ([@matt-edmondson](https://github.com/matt-edmondson)) - Add isolation tests for PropertyMerger class ([@matt-edmondson](https://github.com/matt-edmondson)) - Add unit tests for PropertyMerger class ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.2.0 (minor) Changes since v1.1.0: - Add unit tests for Frontmatter functionality and update solution file ([@matt-edmondson](https://github.com/matt-edmondson)) ## v1.1.0 (major) - Initial commit ([@matt-edmondson](https://github.com/matt-edmondson))

.NET 5.0

.NET 9.0

.NET 10.0

.NET Standard 2.0

.NET Standard 2.1

.NET 8.0

.NET 6.0

.NET 7.0

Version Downloads Last updated
1.2.5 1 02/16/2026
1.2.5-pre.1 2 02/16/2026
1.2.4 15 02/14/2026
1.2.3 15 02/14/2026
1.2.3-pre.12 25 02/11/2026
1.2.3-pre.11 57 02/06/2026
1.2.3-pre.10 57 02/05/2026
1.2.3-pre.9 56 02/04/2026
1.2.3-pre.8 54 02/03/2026
1.2.3-pre.7 57 02/03/2026
1.2.3-pre.6 57 02/02/2026
1.2.3-pre.5 56 02/01/2026
1.2.3-pre.4 57 01/31/2026
1.2.3-pre.3 54 01/31/2026
1.2.3-pre.2 55 01/31/2026
1.2.3-pre.1 58 01/30/2026
1.2.2 59 01/30/2026
1.2.2-pre.3 59 01/29/2026
1.2.2-pre.2 59 01/28/2026
1.2.2-pre.1 56 01/28/2026
1.2.1 59 01/28/2026