Skip to main content

Function: writeCustomDoc()

writeCustomDoc(directory): (customDoc, options) => Promise<void>

Defined in: custom-docs.ts:96

Write a custom doc to EventCatalog.

You can optionally override the path of the custom doc.

Parameters

ParameterType
directorystring

Returns

Function

Parameters

ParameterType
customDocCustomDoc
options{ path: string; }
options.path?string

Returns

Promise<void>

Example

import utils from '@eventcatalog/utils';

const { writeCustomDoc } = utils('/path/to/eventcatalog');

// Write a custom doc to the catalog
// Custom doc would be written to docs/inventory-management.mdx
await writeCustomDoc({
title: 'Inventory Management',
summary: 'This is a summary',
owners: ['John Doe'],
badges: [{ content: 'Badge', backgroundColor: 'red', textColor: 'white' }],
markdown: '# Hello world',
fileName: 'inventory-management',
});

// Write a custom doc to the catalog but override the path
// Custom doc would be written to docs/guides/inventory-management/introduction.mdx
await writeCustomDoc({
title: 'Inventory Management',
summary: 'This is a summary',
owners: ['John Doe'],
badges: [{ content: 'Badge', backgroundColor: 'red', textColor: 'white' }],
markdown: '# Hello world',
fileName: 'introduction',
}, { path: "/guides/inventory-management"});