Metadata Gen (metadata-gen)
A powerful Rust library for extracting, validating, and processing metadata in YAML, TOML, and JSON formats from any content or data file.
• Website • Documentation • Report Bug • Request Feature • Contributing Guidelines
Overview
metadata-gen is a robust Rust library designed for extracting, validating, and processing metadata from various content and data file formats. It focuses on the following key areas:
- Parsing and serialization of metadata in YAML, TOML, and JSON formats
- Extraction of frontmatter metadata from content files
- Generation and management of meta tags for web content
- Efficient processing of both local files and string content
- Flexible integration with static site generators and content management systems
Key features include:
- A unified API for handling metadata across different formats
- Robust error handling and reporting
- Customizable parsing options to accommodate various metadata structures
- Asynchronous file processing capabilities
- Utility functions for HTML entity escaping and unescaping
- Type-safe metadata value handling through a custom
Valueenum - Generation of SEO-friendly meta tags from extracted metadata
metadata-gen aims to provide a stable and powerful foundation for metadata management across all platforms supported by Rust.
Installation
Add this to your Cargo.toml:
[]
= "0.0.1"
Usage
Here are some examples of how to use the library:
Extracting Metadata
use extract_and_prepare_metadata;
let content = r#"---
title: My Post
description: A sample post
keywords: rust, metadata, extraction
---
Content here"#;
let result = extract_and_prepare_metadata;
if let Ok = result
HTML Escape/Unescape Example
use ;
let original = "Hello <World> & \"Friends\"";
let escaped = escape_html;
let unescaped = unescape_html;
println!;
println!;
println!;
Asynchronous File Processing
use async_extract_metadata_from_file;
async
Documentation
For full API documentation, please visit docs.rs/metadata-gen.
Examples
To run the examples, clone the repository and use the following command:
cargo run --example example_name
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Acknowledgements
Special thanks to all contributors who have helped build the metadata-gen library.