src/language-html/printer-html.js/embed
function embed(path, print, textToDoc, options) {
  const node = path.getValue();

  switch (node.type) {
    case "element": {
      if (isScriptLikeTag(node) || node.type === "interpolation") {
        // Fall through to "text"
        return;
      }

      if (isVueNonHtmlBlock(node, options)) {
        const parser = inferScriptParser(node, options);
        if (!parser) {
          return;
        }

        let doc;
        try {
          doc = textToDoc(
            htmlTrimPreserveIndentation(getNodeContent(node, options)),
            { parser }
          );
        } catch (_) {
          return;
        }

        // `textToDoc` don't throw on `production` mode
        if (!doc) {
          return;
        }

        // See https://github.com/prettier/prettier/pull/8465#issuecomment-645273859
        if (typeof doc === "string") {
          doc = doc.replace(/(?:\r?\n)*$/, "");
        }

        return concat([
          printOpeningTagPrefix(node, options),
          group(printOpeningTag(path, options, print)),
          concat([hardline, stripTrailingHardline(doc, true), hardline]),
          printClosingTag(node, options),
          printClosingTagSuffix(node, options),
        ]);
      }
      break;
    }
    case "text": {
      if (isScriptLikeTag(node.parent)) {
        const parser = inferScriptParser(node.parent);
        if (parser) {
          const value =
            parser === "markdown"
              ? dedentString(node.value.replace(/^[^\S\n]*?\n/, ""))
              : node.value;
          const textToDocOptions = { parser };
          if (options.parser === "html" && parser === "babel") {
            let sourceType = "script";
            const { attrMap } = node.parent;
            if (
              attrMap &&
              (attrMap.type === "module" ||
                (attrMap.type === "text/babel" &&
                  attrMap["data-type"] === "module"))
            ) {
              sourceType = "module";
            }
            textToDocOptions.__babelSourceType = sourceType;
          }
          return builders.concat([
            concat([
              breakParent,
              printOpeningTagPrefix(node, options),
              stripTrailingHardline(textToDoc(value, textToDocOptions)),
              printClosingTagSuffix(node, options),
            ]),
          ]);
        }
      } else if (node.parent.type === "interpolation") {
        return concat([
          indent(
            concat([
              line,
              textToDoc(node.value, {
                __isInHtmlInterpolation: true, // to avoid unexpected `}}`
                ...(options.parser === "angular"
                  ? { parser: "__ng_interpolation", trailingComma: "none" }
                  : options.parser === "vue"
                  ? { parser: "__vue_expression" }
                  : { parser: "__js_expression" }),
              }),
            ])
          ),
          node.parent.next &&
          needsToBorrowPrevClosingTagEndMarker(node.parent.next)
            ? " "
            : line,
        ]);
      }
      break;
    }
    case "attribute": {
      if (!node.value) {
        break;
      }

      // lit-html: html`<my-element obj=${obj}></my-element>`
      if (
        /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(
          options.originalText.slice(
            node.valueSpan.start.offset,
            node.valueSpan.end.offset
          )
        )
      ) {
        return concat([node.rawName, "=", node.value]);
      }

      // lwc: html`<my-element data-for={value}></my-element>`
      if (options.parser === "lwc") {
        const interpolationRegex = /^{[\S\s]*}$/;
        if (
          interpolationRegex.test(
            options.originalText.slice(
              node.valueSpan.start.offset,
              node.valueSpan.end.offset
            )
          )
        ) {
          return concat([node.rawName, "=", node.value]);
        }
      }

      const embeddedAttributeValueDoc = printEmbeddedAttributeValue(
        node,
        (code, opts) =>
          // strictly prefer single quote to avoid unnecessary html entity escape
          textToDoc(code, { __isInHtmlAttribute: true, ...opts }),
        options
      );
      if (embeddedAttributeValueDoc) {
        return concat([
          node.rawName,
          '="',
          group(
            mapDoc(embeddedAttributeValueDoc, (doc) =>
              typeof doc === "string" ? doc.replace(/"/g, "&quot;") : doc
            )
          ),
          '"',
        ]);
      }
      break;
    }
    case "front-matter":
      if (node.lang === "yaml") {
        return markAsRoot(
          concat([
            "---",
            hardline,
            node.value.trim().length === 0
              ? ""
              : textToDoc(node.value, { parser: "yaml" }),
            "---",
          ])
        );
      }
  }
}