docusaurus-graphql-plugin
Version:
Docusaurus plugin generating Markdown documentation from a GraphQL schema.
17 lines (16 loc) • 678 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertUnionToMarkdown = void 0;
function convertUnionToMarkdown(union, options) {
const lines = [];
lines.push(`## ${union.name}`, `\n\n`);
lines.push(union.description || "", `\n\n`);
lines.push(`<p style={{ marginBottom: "0.4em" }}><strong>Possible types</strong></p>`, `\n\n`);
union.getTypes().forEach((type) => {
const typeUrl = options.getTypePath(type);
lines.push(typeUrl ? `- [${type.name}](${typeUrl})` : `- ${type.name}`, `\n`);
});
lines.push(`\n`);
return lines.join("");
}
exports.convertUnionToMarkdown = convertUnionToMarkdown;