comment

Function comment 

Source
pub fn comment<S: ToString, P: AsRef<Path>>(content: S, path: P) -> String
Expand description

Turn the given content into a comment for the given path

ยงExamples

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!");