format/slim.js
/**
 * Updates formatting properties for given output node
 * NB Unlike HTML, Slim is indent-based format so some formatting options from
 * `profile` will not take effect, otherwise output will be broken
 * @param  {OutputNode} outNode Output wrapper of farsed abbreviation node
 * @param  {Profile}    profile Output profile
 * @return {OutputNode}
 */
Updates formatting properties for given output node
NB Unlike HTML, Slim is indent-based format so some formatting options from
`profile` will not take effect, otherwise output will be broken
@param  {OutputNode} outNode Output wrapper of farsed abbreviation node
@param  {Profile}    profile Output profile
@return {OutputNode}
Updates formatting properties for given output node NB Unlike HTML Slim is indent - based format so some formatting options from ` profile ` will not take effect otherwise output will be broken @param { OutputNode } outNode Output wrapper of farsed abbreviation node @param { Profile } profile Output profile @return { OutputNode }
function updateFormatting(outNode, profile) {
	const node = outNode.node;
	const parent = node.parent;
	if (profile.get('inlineBreak') === 0 && isInline(node, profile)
		&& !isRoot(parent) && parent.value == null && parent.children.length === 1) {
		outNode.beforeOpen = ': ';
	}
	if (!node.isTextOnly && node.value) {
		outNode.beforeText = reNl.test(node.value)
			? outNode.newline + outNode.indent + profile.indent(1)
			: ' ';
	}
	return outNode;
}
function updateFormatting ( outNode , profile ) { const node = outNode . node ; const parent = node . parent ; if ( profile . get ( 'inlineBreak' ) === 0 && isInline ( node , profile ) && ! isRoot ( parent ) && parent . value == null && parent . children . length === 1 ) { outNode . beforeOpen = ': ' ; } if ( ! node . isTextOnly && node . value ) { outNode . beforeText = reNl . test ( node . value ) ? outNode . newline + outNode . indent + profile . indent ( 1 ) : ' ' ; } return outNode ; }
Updates formatting properties for given output node
 NB Unlike HTML, Slim is indent-based format so some formatting options from
 `profile` will not take effect, otherwise output will be broken
 @param  {OutputNode} outNode Output wrapper of farsed abbreviation node
 @param  {Profile}    profile Output profile
 @return {OutputNode}
Updates formatting properties for given output node NB Unlike HTML Slim is indent - based format so some formatting options from ` profile ` will not take effect otherwise output will be broken @param { OutputNode } outNode Output wrapper of farsed abbreviation node @param { Profile } profile Output profile @return { OutputNode }
// Edge case: a single inline-level child inside node without text: // allow it to be inlined // node with text: put a space before single-line text