commented

Crates.iocommented
lib.rscommented
version0.1.0
created_at2025-07-05 20:11:59.459909+00
updated_at2025-07-05 20:11:59.459909+00
descriptionIf you want to comment a line for an unknown file type, this crate is what you want
homepage
repositoryhttps://github.com/
max_upload_size
id1739445
size155,458
Nik Revenco (nik-rev)

documentation

README

This crate contains the comment function, which turns the passed input into a comment for the given file type

use commented::comment;

assert_eq!(comment("hello, world!", "index.html"), "<!-- hello, world! -->");
assert_eq!(comment("hello, world!", "main.rs"), "/* hello, world! */");
assert_eq!(comment("hello, world!", "script.lua"), "--[[ hello, world! --]]");
// fallback to `#`, as that's the most common comment tokens for
// files without an extension
assert_eq!(comment("hello, world!", "123456789"), "# hello, world!");
Commit count: 0

cargo fmt