myst-cli
Version:
Command line tools for MyST
28 lines (27 loc) • 789 B
JavaScript
export function createArticleTitle(blockTitle, authors) {
const headings = [];
if (blockTitle) {
headings.push({
type: 'heading',
depth: 1,
children: [{ type: 'text', value: blockTitle }],
});
}
// TODO: actually do a subtitle
const authorNames = !authors ? undefined : authors.map((v) => v.name || 'Unknown Author');
if (authorNames && authorNames.length) {
headings.push({
type: 'heading',
depth: 4,
children: [{ type: 'text', value: authorNames.join(', ') }],
});
}
return headings;
}
export function createReferenceTitle() {
return {
type: 'heading',
depth: 2,
children: [{ type: 'text', value: 'References' }],
};
}