function printAttributeWithValuePrinter(printValue) {
  return async (textToDoc, print, path, options) => {
    let valueDoc = await printValue(textToDoc, print, path, options);

    if (!valueDoc) {
      return;
    }

    valueDoc = mapDoc(valueDoc, (doc) =>
      typeof doc === "string" ? doc.replaceAll('"', "&quot;") : doc,
    );

    return [path.node.rawName, '="', group(valueDoc), '"'];
  };
}
@param {(textToDoc, print, path, options) => Promise<Doc>} printValue
@returns {(textToDoc, print, path, options) => Promise<Doc>}