Skip to main content

Crate metadata_gen

Crate metadata_gen 

Source
Expand description

Metadata Gen logo

Metadata Gen

A Rust library for extracting, validating, and processing metadata in YAML, TOML, and JSON formats.

Build Crates.io Docs.rs Coverage lib.rs


§Install

cargo add metadata-gen

Or add to Cargo.toml:

[dependencies]
metadata-gen = "0.0.3"

You need Rust 1.56.0 or later. Works on macOS, Linux, and Windows.


§Overview

Metadata Gen extracts, validates, and processes metadata from content files in YAML, TOML, and JSON formats.

  • Multi-format extraction from any content file
  • HTML meta tag generation for SEO
  • Validation of metadata structure and required fields
  • Serde integration for typed metadata access

§Features

Multi-formatExtract metadata from YAML, TOML, and JSON
ValidationValidate metadata structure and required fields
Meta tagsGenerate HTML meta tags from metadata
Content filesProcess metadata from any content or data file
Serde integrationSerialize/deserialize metadata to Rust structs

§Usage

use metadata_gen::extract_metadata;

fn main() {
    let content = "---\ntitle: Example\n---\nBody text.";
    let meta = extract_metadata(content).unwrap();
    println!("Title: {}", meta.get("title").unwrap());
}

§Development

cargo build        # Build the project
cargo test         # Run all tests
cargo clippy       # Lint with Clippy
cargo fmt          # Format with rustfmt

See CONTRIBUTING.md for setup, signed commits, and PR guidelines.


THE ARCHITECTSebastien Rousseau THE ENGINEEUXIS ᛫ Enterprise Unified Execution Intelligence System


§License

Dual-licensed under Apache 2.0 or MIT, at your option.

Back to Top

Re-exports§

pub use error::MetadataError;
pub use metadata::extract_metadata;
pub use metadata::process_metadata;
pub use metadata::Metadata;
pub use metatags::generate_metatags;
pub use metatags::MetaTagGroups;
pub use utils::async_extract_metadata_from_file;
pub use utils::escape_html;

Modules§

error
The error module contains error types for metadata processing. Error types for the metadata-gen library.
metadata
The metadata module contains functions for extracting and processing metadata. Metadata extraction and processing module.
metatags
The metatags module contains functions for generating meta tags. Meta tag generation and extraction module.
utils
The utils module contains utility functions for metadata processing. Utility functions for metadata processing and HTML manipulation.

Functions§

extract_and_prepare_metadata
Extracts metadata from the content, generates keywords based on the metadata, and prepares meta tag groups.
extract_keywords
Extracts keywords from the metadata.

Type Aliases§

Keywords
Type alias for a list of keywords.
MetadataMap
Type alias for a map of metadata key-value pairs.
MetadataResult
Type alias for the result of metadata extraction and processing.