prettierx
Version:
prettierX - a less opinionated fork of the Prettier code formatter
24 lines (20 loc) • 475 B
JavaScript
;
const {
builders: { hardline, markAsRoot },
} = require("../../document");
function print(node, textToDoc) {
if (node.lang === "yaml") {
const value = node.value.trim();
const doc = value
? textToDoc(value, { parser: "yaml" }, { stripTrailingHardline: true })
: "";
return markAsRoot([
node.startDelimiter,
hardline,
doc,
doc ? hardline : "",
node.endDelimiter,
]);
}
}
module.exports = print;