async function formatAttributeValue(
  code,
  textToDoc,
  options,
  shouldHugJsExpression,
) {
  options = {
    // strictly prefer single quote to avoid unnecessary html entity escape
    __isInHtmlAttribute: true,
    __embeddedInHtml: true,
    ...options,
  };

  let shouldHug = true;
  if (shouldHugJsExpression) {
    options.__onHtmlBindingRoot = (ast, options) => {
      shouldHug = shouldHugJsExpression(ast, options);
    };
  }

  const doc = await textToDoc(code, options, textToDoc);

  return shouldHug ? group(doc) : printExpand(doc);
}
@param {string} code
@param {Function} textToDoc
@param {*} options
@param {(ast: any, options: any) => boolean} [shouldHugJsExpression]
@returns {Promise<Doc>}