Skip to main content

yaml_scalar

Function yaml_scalar 

Source
pub fn yaml_scalar(v: &str) -> String
Expand description

Quote a frontmatter scalar value if it would not be a safe bare YAML scalar. Shared by the authoring verbs and the --script engine so a value written by either path round-trips identically.

ยงExamples

use coding_tools::okf::yaml_scalar;

assert_eq!(yaml_scalar("Customers"), "Customers");
assert_eq!(yaml_scalar("a: b"), "\"a: b\"");