Skip to content

Commit 08359e0

Browse files
Merge pull request #10 from sebastienrousseau/feat/html-generator
v0.0.2
2 parents 823c1d8 + 46cf5cc commit 08359e0

File tree

121 files changed

+11173
-1480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+11173
-1480
lines changed

.github/workflows/coverage.yml

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,32 @@
11
name: 📶 Coverage
22

3-
on:
4-
push:
5-
branches:
6-
- main
7-
pull_request:
8-
9-
env:
10-
CARGO_TERM_COLOR: always
3+
on: [push]
114

125
jobs:
13-
coverage:
14-
name: Code Coverage
6+
lint:
157
runs-on: ubuntu-latest
16-
env:
17-
CARGO_INCREMENTAL: "0"
18-
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
19-
RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
20-
218
steps:
22-
# Checkout the repository
239
- name: Checkout repository
2410
uses: actions/checkout@v4
2511

26-
# Setup Rust nightly
2712
- name: Install Rust
2813
uses: actions-rs/toolchain@v1
29-
id: toolchain
3014
with:
31-
toolchain: nightly
15+
toolchain: stable
3216
override: true
3317

34-
# Configure cache for Cargo
35-
- name: Cache Cargo registry, index
36-
uses: actions/cache@v4
37-
id: cache-cargo
38-
with:
39-
path: |
40-
~/.cargo/registry
41-
~/.cargo/bin
42-
~/.cargo/git
43-
key: linux-${{ steps.toolchain.outputs.rustc_hash }}-rust-cov-${{ hashFiles('**/Cargo.lock') }}
44-
45-
# Run tests with all features
46-
- name: Test (cargo test)
47-
uses: actions-rs/cargo@v1
48-
with:
49-
command: test
50-
args: "--workspace"
18+
- name: Install Cargo Tarpaulin
19+
run: cargo install cargo-tarpaulin
5120

52-
# Install grcov
53-
- uses: actions-rs/grcov@v0.1
54-
id: coverage
21+
- name: Run tests with coverage
22+
run: cargo tarpaulin --out Lcov --all-features --no-fail-fast
23+
env:
24+
CARGO_INCREMENTAL: '0'
25+
RUSTFLAGS: '-Ccodegen-units=1 -Clink-dead-code -Coverflow-checks=off'
26+
RUSTDOCFLAGS: ''
5527

56-
# Upload to Codecov.io
57-
- name: Upload to Codecov.io
28+
- name: Upload coverage to Codecov
5829
uses: codecov/codecov-action@v5
5930
with:
6031
token: ${{ secrets.CODECOV_TOKEN }}
61-
file: ${{ steps.coverage.outputs.report }}
32+
files: lcov.info

Cargo.toml

Lines changed: 221 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[package]
66
name = "html-generator"
7-
version = "0.0.1"
7+
version = "0.0.2"
88
edition = "2021"
99
rust-version = "1.56.0"
1010
license = "MIT OR Apache-2.0"
@@ -28,8 +28,35 @@ categories = [
2828
"development-tools"
2929
]
3030

31+
# Keywords for easier discoverability on Crates.io.
3132
keywords = ["html", "web_development", "seo", "html-generator"]
3233

34+
# Excluding unnecessary files from the package
35+
exclude = [
36+
"/.git/*", # Exclude version control files
37+
"/.github/*", # Exclude GitHub workflows
38+
"/.gitignore", # Ignore Git ignore file
39+
"/.vscode/*" # Ignore VSCode settings
40+
]
41+
42+
# Including necessary files in the package
43+
include = [
44+
"/CONTRIBUTING.md",
45+
"/LICENSE-APACHE",
46+
"/LICENSE-MIT",
47+
"/benches/**",
48+
"/build.rs",
49+
"/Cargo.toml",
50+
"/examples/**",
51+
"/README.md",
52+
"/src/**",
53+
]
54+
55+
# -----------------------------------------------------------------------------
56+
# Library Information
57+
# -----------------------------------------------------------------------------
58+
59+
# The library file that contains the main logic for the binary.
3360
[lib]
3461
name = "html_generator"
3562
path = "src/lib.rs"
@@ -40,43 +67,36 @@ path = "src/lib.rs"
4067

4168
[dependencies]
4269
# Dependencies required for building and running the project.
43-
comrak = "0.29"
44-
frontmatter-gen = "0.0.5"
45-
lazy_static = "1.5"
70+
cfg = "0.9.0"
71+
comrak = "0.31.0"
72+
lazy_static = "1.5.0"
73+
log = "0.4.22"
4674
mdx-gen = "0.0.1"
47-
minify-html = "0.15"
48-
once_cell = "1.20"
49-
regex = "1.11"
50-
scraper = "0.21"
51-
serde = { version = "1.0", features = ["derive"] }
52-
serde_json = "1.0"
53-
tempfile = "3.13"
54-
thiserror = "2.0"
55-
tokio = { version = "1.40", features = ["full"] }
75+
minify-html = "0.15.0"
76+
once_cell = "1.20.2"
77+
regex = "1.11.1"
78+
scraper = "0.21.0"
79+
serde_json = "1.0.133"
80+
tempfile = "3.14.0"
81+
thiserror = "2.0.3"
82+
tokio = { version = "1.41.1", features = ["full"] }
5683

5784
# -----------------------------------------------------------------------------
5885
# Build Dependencies
5986
# -----------------------------------------------------------------------------
6087

6188
[build-dependencies]
6289
# Dependencies for build scripts.
63-
version_check = "0.9.4"
90+
version_check = "0.9.5"
6491

6592
# -----------------------------------------------------------------------------
6693
# Development Dependencies
6794
# -----------------------------------------------------------------------------
6895

6996
[dev-dependencies]
7097
# Dependencies required for testing and development.
71-
criterion = "0.5"
72-
73-
# -----------------------------------------------------------------------------
74-
# Examples
75-
# -----------------------------------------------------------------------------
76-
77-
# [[example]]
78-
# name = "error_example"
79-
# path = "examples/error_example.rs"
98+
criterion = "0.5.1"
99+
test-case = "3.3.1"
80100

81101

82102
# -----------------------------------------------------------------------------
@@ -89,9 +109,184 @@ default = []
89109
async = []
90110

91111
# -----------------------------------------------------------------------------
92-
# Documentation Configuration
112+
# Examples - cargo run --example <name>
113+
# -----------------------------------------------------------------------------
114+
115+
[[example]]
116+
name = "accessibility"
117+
path = "examples/accessibility_example.rs"
118+
119+
[[example]]
120+
name = "basic"
121+
path = "examples/basic_example.rs"
122+
123+
[[example]]
124+
name = "comprehensive"
125+
path = "examples/comprehensive_example.rs"
126+
127+
[[example]]
128+
name = "custom"
129+
path = "examples/custom_config_example.rs"
130+
131+
[[example]]
132+
name = "error"
133+
path = "examples/error_example.rs"
134+
135+
[[example]]
136+
name = "generator"
137+
path = "examples/generator_example.rs"
138+
139+
[[example]]
140+
name = "lib"
141+
path = "examples/lib_example.rs"
142+
143+
[[example]]
144+
name = "performance"
145+
path = "examples/performance_example.rs"
146+
147+
[[example]]
148+
name = "seo"
149+
path = "examples/seo_example.rs"
150+
151+
[[example]]
152+
name = "utils"
153+
path = "examples/utils_example.rs"
154+
93155
# -----------------------------------------------------------------------------
156+
# Criterion Benchmark
157+
# -----------------------------------------------------------------------------
158+
[[bench]] # Benchmarking configuration.
159+
name = "html_benchmark" # Name of the benchmark.
160+
harness = false # Disable the default benchmark harness.
94161

162+
# -----------------------------------------------------------------------------
163+
# Documentation Configuration
164+
# -----------------------------------------------------------------------------
95165
[package.metadata.docs.rs]
96-
all-features = true
97-
rustdoc-args = ["--cfg", "docsrs"]
166+
# Settings for building and hosting documentation on docs.rs.
167+
all-features = true # Build documentation with all features enabled
168+
rustdoc-args = ["--cfg", "docsrs"] # Arguments passed to `rustdoc` when building the documentation
169+
targets = ["x86_64-unknown-linux-gnu"] # Default target platform for the docs
170+
171+
# -----------------------------------------------------------------------------
172+
# Linting Configuration
173+
# -----------------------------------------------------------------------------
174+
[lints.rust]
175+
# Linting rules for the project.
176+
177+
## Warnings
178+
missing_copy_implementations = "warn" # Warn if types can implement `Copy` but don’t
179+
missing_docs = "warn" # Warn if public items lack documentation
180+
unstable_features = "warn" # Warn on the usage of unstable features
181+
unused_extern_crates = "warn" # Warn about unused external crates
182+
unused_results = "warn" # Warn if a result type is unused (e.g., errors ignored)
183+
184+
## Allowances
185+
bare_trait_objects = "allow" # Allow bare trait objects (e.g., `Box<dyn Trait>`)
186+
elided_lifetimes_in_paths = "allow" # Allow lifetimes to be elided in paths
187+
non_camel_case_types = "allow" # Allow non-camel-case types
188+
non_upper_case_globals = "allow" # Allow non-uppercase global variables
189+
trivial_bounds = "allow" # Allow trivial bounds in trait definitions
190+
unsafe_code = "allow" # Allow the usage of unsafe code blocks
191+
192+
## Forbidden
193+
missing_debug_implementations = "forbid" # Forbid missing `Debug` implementations
194+
non_ascii_idents = "forbid" # Forbid non-ASCII identifiers
195+
unreachable_pub = "forbid" # Forbid unreachable `pub` items
196+
197+
## Denials
198+
dead_code = "deny" # Deny unused, dead code in the project
199+
deprecated_in_future = "deny" # Deny code that will be deprecated in the future
200+
ellipsis_inclusive_range_patterns = "deny" # Deny usage of inclusive ranges in match patterns (`...`)
201+
explicit_outlives_requirements = "deny" # Deny unnecessary lifetime outlives requirements
202+
future_incompatible = { level = "deny", priority = -1 } # Handle future compatibility issues
203+
keyword_idents = { level = "deny", priority = -1 } # Deny usage of keywords as identifiers
204+
macro_use_extern_crate = "deny" # Deny macro use of `extern crate`
205+
meta_variable_misuse = "deny" # Deny misuse of meta variables in macros
206+
missing_fragment_specifier = "deny" # Deny missing fragment specifiers in macros
207+
noop_method_call = "deny" # Deny method calls that have no effect
208+
rust_2018_idioms = { level = "deny", priority = -1 } # Enforce Rust 2018 idioms
209+
rust_2021_compatibility = { level = "deny", priority = -1 } # Enforce Rust 2021 compatibility
210+
single_use_lifetimes = "deny" # Deny lifetimes that are used only once
211+
trivial_casts = "deny" # Deny trivial casts (e.g., `as` when unnecessary)
212+
trivial_numeric_casts = "deny" # Deny trivial numeric casts (e.g., `i32` to `i64`)
213+
unused = { level = "deny", priority = -1 } # Deny unused code, variables, etc.
214+
unused_features = "deny" # Deny unused features
215+
unused_import_braces = "deny" # Deny unnecessary braces around imports
216+
unused_labels = "deny" # Deny unused labels in loops
217+
unused_lifetimes = "deny" # Deny unused lifetimes
218+
unused_macro_rules = "deny" # Deny unused macros
219+
unused_qualifications = "deny" # Deny unnecessary type qualifications
220+
variant_size_differences = "deny" # Deny enum variants with significant size differences
221+
222+
# -----------------------------------------------------------------------------
223+
# Clippy Configuration
224+
# -----------------------------------------------------------------------------
225+
[package.metadata.clippy]
226+
# Clippy lint configuration for enhanced code analysis.
227+
warn-lints = [
228+
"clippy::all", # Enable all common Clippy lints
229+
"clippy::pedantic", # Enable pedantic lints for stricter checking
230+
"clippy::cargo", # Enable lints specific to cargo
231+
"clippy::nursery", # Enable experimental lints from Clippy’s nursery
232+
"clippy::complexity", # Warn on code complexity and suggest improvements
233+
"clippy::correctness", # Ensure code correctness, flagging potential issues
234+
"clippy::perf", # Lints that catch performance issues
235+
"clippy::style", # Suggest stylistic improvements
236+
"clippy::suspicious", # Detect suspicious code patterns
237+
"clippy::module_name_repetitions", # Avoid repeating module names in the crate name
238+
]
239+
240+
# Customize Clippy to allow certain less critical lints.
241+
allow-lints = [
242+
"clippy::module_inception", # Allow modules with the same name as their parents
243+
"clippy::too_many_arguments", # Allow functions with more than 7 arguments if justified
244+
"clippy::missing_docs_in_private_items", # Skip requiring documentation for private items
245+
]
246+
247+
# Enforce specific warnings and errors more strictly.
248+
deny-lints = [
249+
"clippy::unwrap_used", # Deny the use of unwrap to ensure error handling
250+
"clippy::expect_used", # Deny the use of expect to avoid improper error handling
251+
]
252+
253+
# -----------------------------------------------------------------------------
254+
# Profiles
255+
# -----------------------------------------------------------------------------
256+
[profile.dev]
257+
# Development profile configuration for fast builds and debugging.
258+
codegen-units = 256 # Increase codegen units for faster compilation
259+
debug = true # Enable debugging symbols
260+
debug-assertions = true # Enable debug assertions
261+
incremental = true # Enable incremental compilation
262+
lto = false # Disable link-time optimization for development
263+
opt-level = 0 # No optimizations in development
264+
overflow-checks = true # Enable overflow checks for arithmetic operations
265+
panic = 'unwind' # Enable unwinding for panics (useful in development)
266+
rpath = false # Disable rpath generation
267+
strip = false # Do not strip symbols in development builds
268+
269+
[profile.release]
270+
# Release profile configuration for optimized builds.
271+
codegen-units = 1 # Reduce codegen units for better performance
272+
debug = false # Disable debug symbols in release builds
273+
debug-assertions = false # Disable debug assertions
274+
incremental = false # Disable incremental compilation for optimal binary size
275+
lto = true # Enable link-time optimization for smaller and faster binaries
276+
opt-level = "z" # Optimize for binary size
277+
overflow-checks = false # Disable overflow checks for performance
278+
panic = "abort" # Use abort on panic for minimal overhead
279+
rpath = false # Disable rpath generation
280+
strip = "symbols" # Strip symbols for smaller binary size
281+
282+
[profile.test]
283+
# Test profile configuration for debugging and development.
284+
codegen-units = 256 # Increase codegen units for faster test builds
285+
debug = true # Enable debugging symbols for test builds
286+
debug-assertions = true # Enable debug assertions for tests
287+
incremental = true # Enable incremental compilation for tests
288+
lto = false # Disable link-time optimization during testing
289+
opt-level = 0 # No optimizations in test builds
290+
overflow-checks = true # Enable overflow checks for tests
291+
rpath = false # Disable rpath generation
292+
strip = false # Do not strip symbols in test builds

0 commit comments

Comments
 (0)