format/html.js
/**
 * Renders given parsed Emmet abbreviation as HTML, formatted according to
 * `profile` options
 * @param  {Node}     tree    Parsed Emmet abbreviation
 * @param  {Profile}  profile Output profile
 * @param  {Object}  [options] Additional formatter options
 * @return {String}
 */
Renders given parsed Emmet abbreviation as HTML, formatted according to
`profile` options
@param  {Node}     tree    Parsed Emmet abbreviation
@param  {Profile}  profile Output profile
@param  {Object}  [options] Additional formatter options
@return {String}
Renders given parsed Emmet abbreviation as HTML formatted according to ` profile ` options @param { Node } tree Parsed Emmet abbreviation @param { Profile } profile Output profile @param { Object } [ options ] Additional formatter options @return { String }
function html(tree, profile, options) {
	options = Object.assign({}, options);
	const format = getFormatOptions(options);
	return render(tree, options.field, outNode => {
		outNode = setFormatting(outNode, profile);
		if (!handlePseudoSnippet(outNode)) {
			const node = outNode.node;
			if (node.name) {
				const name = profile.name(node.name);
				const attrs = formatAttributes(outNode, profile);
				outNode.open = `<${name}${attrs}${node.selfClosing ? profile.selfClose() : ''}>`;
				if (!node.selfClosing) {
					outNode.close = `</${name}>`;
				}
				commentNode(outNode, format.comment);
			}
			if (node.value || (!node.children.length && !node.selfClosing) ) {
				outNode.text = outNode.renderFields(node.value);
			}
		}
		return outNode;
	});
}
function html ( tree , profile , options ) { options = Object . assign ( { } , options ) ; const format = getFormatOptions ( options ) ; return render ( tree , options . field , outNode => { outNode = setFormatting ( outNode , profile ) ; if ( ! handlePseudoSnippet ( outNode ) ) { const node = outNode . node ; if ( node . name ) { const name = profile . name ( node . name ) ; const attrs = formatAttributes ( outNode , profile ) ; outNode . open = ` ${ name } ${ attrs } ${ node . selfClosing ? profile . selfClose ( ) : '' } ` ; if ( ! node . selfClosing ) { outNode . close = ` ${ name } ` ; } commentNode ( outNode , format . comment ) ; } if ( node . value || ( ! node . children . length && ! node . selfClosing ) ) { outNode . text = outNode . renderFields ( node . value ) ; } } return outNode ; } ) ; }
Renders given parsed Emmet abbreviation as HTML, formatted according to
 `profile` options
 @param  {Node}     tree    Parsed Emmet abbreviation
 @param  {Profile}  profile Output profile
 @param  {Object}  [options] Additional formatter options
 @return {String}
Renders given parsed Emmet abbreviation as HTML formatted according to ` profile ` options @param { Node } tree Parsed Emmet abbreviation @param { Profile } profile Output profile @param { Object } [ options ] Additional formatter options @return { String }
// Do not generate fields for nodes with empty value and children // or if node is self-closed