addSection

Add a custom section to the generator instance.

Usage:

TypeScript
import { Generator, Section, SectionNode, TemplateNodeType } from "relno";

class MySection extends Section {
    public constructor() {
        super("mySection");
    }

    public async parse(
        generator: Generator,
        sectionNode: SectionNode,
    ): Promise<SectionNode> {
        const result: SectionNode = {
            type: TemplateNodeType.Section,
            name: sectionNode.name,
            tags: sectionNode.tags,
            children: [],
        };
        for (const child of sectionNode.children) {
            result.children.push(
                await generator.parseNode(generator, child, {}),
            );
        }
        return result;
    }
}

const generator = new Generator([], {
    template: "",
    prTypes: [],
    metadata: {} as ReleaseMetadata,
});
generator.addSection(new MySection());

Learn more about custom section.