Skip to content

Commit

Permalink
feat: prettier yaml multi-line formatting
Browse files Browse the repository at this point in the history
Fixes: #144
  • Loading branch information
CertainLach committed Jan 16, 2024
1 parent dbbcbc4 commit 1a20c75
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/jrsonnet-stdlib/src/manifest/yaml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ fn manifest_yaml_ex_buf(
buf.push_str(&options.padding);
buf.push_str(line);
}
} else if s.contains('\n') {
buf.push_str("|-");
for line in s.split('\n') {
buf.push('\n');
buf.push_str(cur_padding);
buf.push_str(&options.padding);
buf.push_str(line);
}
} else if !options.quote_keys && !yaml_needs_quotes(&s) {
buf.push_str(&s);
} else {
Expand Down

0 comments on commit 1a20c75

Please sign in to comment.