Skip to content

Commit

Permalink
feat(ssg): ✨ migrating to html-gen
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Oct 6, 2024
1 parent dfd0779 commit 548585d
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 56 deletions.
46 changes: 23 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["ssg", "ssg-cli", "ssg-core", "ssg-html", "ssg-i18n", "ssg-server", "ssg-sitemap", "ssg-template"]
members = ["ssg", "ssg-cli", "ssg-core", "html-gen", "ssg-i18n", "ssg-server", "ssg-sitemap", "ssg-template"]
resolver = "2"

[workspace.package]
Expand Down
6 changes: 3 additions & 3 deletions ssg-html/Cargo.toml → html-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "ssg-html"
name = "html-gen"
version = "0.0.1"
edition = "2021"
authors = ["Your Name <your.email@example.com>"]
description = "HTML generation and optimization for static site generators"
license = "MIT OR Apache-2.0"
repository = "https://github.com/yourusername/ssg-html"
documentation = "https://docs.rs/ssg-html"
repository = "https://github.com/yourusername/html-gen"
documentation = "https://docs.rs/html-gen"
readme = "README.md"
keywords = ["html", "markdown", "ssg", "static-site-generator"]
categories = ["web-programming", "text-processing"]
Expand Down
24 changes: 12 additions & 12 deletions ssg-html/README.md → html-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
alt="Shokunin logo" height="66" align="right" />
<!-- markdownlint-enable MD033 MD041 -->

# Shokunin HTML Generator (ssg-html)
# Shokunin HTML Generator (html-gen)

A Rust-based HTML generation and optimization library for static site generators.

Expand All @@ -21,7 +21,7 @@ A Rust-based HTML generation and optimization library for static site generators

## Overview

The `ssg-html` crate is a powerful and flexible HTML generation and optimization library designed specifically for static site generators. It provides a robust set of tools for converting Markdown to HTML, enhancing SEO, improving accessibility, and optimizing performance.
The `html-gen` crate is a powerful and flexible HTML generation and optimization library designed specifically for static site generators. It provides a robust set of tools for converting Markdown to HTML, enhancing SEO, improving accessibility, and optimizing performance.

## Features

Expand All @@ -38,15 +38,15 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
ssg-html = "0.1.0"
html-gen = "0.1.0"
```

## Usage

Here's a basic example of how to use `ssg-html`:
Here's a basic example of how to use `html-gen`:

```rust
use ssg_html::{generate_html, HtmlConfig};
use html_gen::{generate_html, HtmlConfig};

fn main() {
let markdown = "# Hello, world!\n\nThis is a test.";
Expand All @@ -72,7 +72,7 @@ The `HtmlConfig` struct allows you to customize the HTML generation process:

## Documentation

For full API documentation, please visit [docs.rs/ssg-html][9].
For full API documentation, please visit [docs.rs/html-gen][9].

## Contributing

Expand All @@ -95,13 +95,13 @@ Special thanks to all the contributors who have helped shape the Shokunin Static
[2]: https://opensource.org/licenses/MIT
[4]: https://github.com/sebastienrousseau/shokunin/issues
[5]: https://github.com/sebastienrousseau/shokunin/blob/main/CONTRIBUTING.md
[8]: https://crates.io/crates/ssg-html
[9]: https://docs.rs/ssg-html
[10]: https://lib.rs/crates/ssg-html
[8]: https://crates.io/crates/html-gen
[9]: https://docs.rs/html-gen
[10]: https://lib.rs/crates/html-gen
[14]: https://www.rust-lang.org

[crates-badge]: https://img.shields.io/crates/v/ssg-html.svg?style=for-the-badge 'Crates.io badge'
[docs-badge]: https://img.shields.io/docsrs/ssg-html.svg?style=for-the-badge 'Docs.rs badge'
[crates-badge]: https://img.shields.io/crates/v/html-gen.svg?style=for-the-badge 'Crates.io badge'
[docs-badge]: https://img.shields.io/docsrs/html-gen.svg?style=for-the-badge 'Docs.rs badge'
[libs-badge]: https://img.shields.io/badge/lib.rs-v0.1.0-orange.svg?style=for-the-badge 'Lib.rs badge'
[license-badge]: https://img.shields.io/crates/l/ssg-html.svg?style=for-the-badge 'License badge'
[license-badge]: https://img.shields.io/crates/l/html-gen.svg?style=for-the-badge 'License badge'
[made-with-rust]: https://img.shields.io/badge/rust-f04041?style=for-the-badge&labelColor=c0282d&logo=rust 'Made With Rust badge'
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions ssg-html/src/generator.rs → html-gen/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use mdx_gen::{process_markdown, ComrakOptions, MarkdownOptions};
/// # Example
///
/// ```rust
/// use ssg_html::HtmlConfig;
/// use ssg_html::generate_html;
/// use html_gen::HtmlConfig;
/// use html_gen::generate_html;
/// let markdown = "# Hello, world!";
/// let config = HtmlConfig::default();
/// let html = generate_html(markdown, &config).unwrap();
Expand Down Expand Up @@ -51,7 +51,7 @@ pub fn generate_html(
/// # Example
///
/// ```rust
/// use ssg_html::generator::markdown_to_html_with_extensions;
/// use html_gen::generator::markdown_to_html_with_extensions;
/// let markdown = "~~strikethrough~~";
/// let html = markdown_to_html_with_extensions(markdown).unwrap();
/// assert!(html.contains("<del>strikethrough</del>"));
Expand Down
10 changes: 5 additions & 5 deletions ssg-html/src/lib.rs → html-gen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// src/lib.rs

//! # ssg-html
//! # html-gen
//!
//! `ssg-html` is a library for processing and generating HTML content,
//! `html-gen` is a library for processing and generating HTML content,
//! particularly useful for static site generators. It provides utilities
//! for handling Markdown front matter, formatting HTML headers with IDs
//! and classes, and other HTML-related tasks.
Expand All @@ -19,15 +19,15 @@
//!
//! ```toml
//! [dependencies]
//! ssg-html = "0.1.0"
//! html-gen = "0.1.0"
//! ```
//!
//! Then, you can use the library in your Rust code:
//!
//! ```rust
//! use ssg_html::utils::{extract_front_matter, format_header_with_id_class};
//! use html_gen::utils::{extract_front_matter, format_header_with_id_class};
//!
//! fn main() -> ssg_html::error::Result<()> {
//! fn main() -> html_gen::error::Result<()> {
//! let content = "---\ntitle: My Page\n---\n# Hello, world!\n\nThis is a test.";
//! let content_without_front_matter = extract_front_matter(content)?;
//! println!("Content: {}", content_without_front_matter);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions ssg-html/src/seo.rs → html-gen/src/seo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use scraper::{Html, Selector};
/// # Examples
///
/// ```
/// use ssg_html::seo::generate_meta_tags;
/// use html_gen::seo::generate_meta_tags;
///
/// let html = r#"<html><head><title>Test Page</title></head><body><p>This is a test page.</p></body></html>"#;
/// let meta_tags = generate_meta_tags(html).unwrap();
Expand Down Expand Up @@ -101,7 +101,7 @@ pub fn generate_meta_tags(html: &str) -> Result<String> {
/// # Examples
///
/// ```
/// use ssg_html::seo::generate_structured_data;
/// use html_gen::seo::generate_structured_data;
///
/// let html = r#"<html><head><title>Test Page</title></head><body><p>This is a test page.</p></body></html>"#;
/// let structured_data = generate_structured_data(html).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions ssg-html/src/utils.rs → html-gen/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static CONSECUTIVE_HYPHENS_REGEX: Lazy<Regex> = Lazy::new(|| {
/// # Examples
///
/// ```
/// use ssg_html::utils::extract_front_matter;
/// use html_gen::utils::extract_front_matter;
///
/// let content = "---\ntitle: My Page\n---\n# Hello, world!\n\nThis is a test.";
/// let result = extract_front_matter(content).unwrap();
Expand Down Expand Up @@ -91,7 +91,7 @@ pub fn extract_front_matter(content: &str) -> Result<String> {
/// # Examples
///
/// ```
/// use ssg_html::utils::format_header_with_id_class;
/// use html_gen::utils::format_header_with_id_class;
///
/// let header = "<h2>Hello, World!</h2>";
/// let result = format_header_with_id_class(header).unwrap();
Expand Down Expand Up @@ -139,7 +139,7 @@ pub fn format_header_with_id_class(header: &str) -> Result<String> {
/// # Examples
///
/// ```
/// use ssg_html::utils::generate_table_of_contents;
/// use html_gen::utils::generate_table_of_contents;
///
/// let html = "<h1>Title</h1><p>Some content</p><h2>Subtitle</h2><p>More content</p>";
/// let toc = generate_table_of_contents(html).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion ssg-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ yaml-rust2 = "0.9"
uuid = { version = "1.10", features = ["v4"] }
vrd = "0.0.8"

ssg-html = { path = "../ssg-html", version = "0.0.1" }
html-gen = { path = "../html-gen", version = "0.0.1" }
ssg-server = { path = "../ssg-server", version = "0.0.1" }
ssg-sitemap = { path = "../ssg-sitemap", version = "0.0.1" }
ssg-template = { path = "../ssg-template", version = "0.0.1" }
Expand Down
2 changes: 1 addition & 1 deletion ssg-core/src/compiler/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

use anyhow::{Context as AnyhowContext, Result};
use html_gen::{generate_html, HtmlConfig};
use rlg::log_level::LogLevel;
use rss_gen::{data::RssData, generate_rss, macro_set_rss_data_fields};
use ssg_html::{generate_html, HtmlConfig};
use ssg_sitemap::create_site_map_data;
use std::time::Duration;

Expand Down
2 changes: 1 addition & 1 deletion ssg-core/src/utilities/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::models::data::FileData;

// Import the minify_html function.
use ssg_html::performance::minify_html;
use html_gen::performance::minify_html;

// Import the fs module.
use std::fs::{self, copy, read_dir};
Expand Down
2 changes: 1 addition & 1 deletion ssg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vrd = "0.0.8"

ssg-cli = { path = "../ssg-cli", version = "0.0.1" }
ssg-core = { path = "../ssg-core", version = "0.0.1" }
ssg-html = { path = "../ssg-html", version = "0.0.1" }
html-gen = { path = "../html-gen", version = "0.0.1" }
ssg-i18n = { path = "../ssg-i18n", version = "0.0.1" }
ssg-server = { path = "../ssg-server", version = "0.0.1" }
ssg-sitemap = { path = "../ssg-sitemap", version = "0.0.1" }
Expand Down

0 comments on commit 548585d

Please sign in to comment.