Skip to content

ConventionRenderer

PromptScript API


Defined in: formatters/src/convention-renderer.ts:36

Convention renderer for applying output conventions to formatted content.

Constructors

Constructor

new ConventionRenderer(conventionOrOptions?): ConventionRenderer

Defined in: formatters/src/convention-renderer.ts:41

Parameters

conventionOrOptions?

string | OutputConvention | ConventionRendererOptions = 'xml'

Returns

ConventionRenderer

Methods

getConvention()

getConvention(): OutputConvention

Defined in: formatters/src/convention-renderer.ts:91

Get the current convention.

Returns

OutputConvention


getPrettierOptions()

getPrettierOptions(): Required<PrettierMarkdownOptions>

Defined in: formatters/src/convention-renderer.ts:84

Get the current Prettier options.

Returns

Required<PrettierMarkdownOptions>


getSectionSeparator()

getSectionSeparator(): string

Defined in: formatters/src/convention-renderer.ts:168

Get the section separator based on convention. Returns ‘\n\n’ (double newline) for all conventions.

Returns

string


renderCodeBlock()

renderCodeBlock(code, language?): string

Defined in: formatters/src/convention-renderer.ts:149

Render a code block.

Parameters

code

string

language?

string = ''

Returns

string


renderList()

renderList(items): string

Defined in: formatters/src/convention-renderer.ts:141

Render a list of items.

Parameters

items

string[]

Returns

string


renderSection()

renderSection(name, content, level?): string

Defined in: formatters/src/convention-renderer.ts:102

Render a section with the convention.

Parameters

name

string

Section name (e.g., ‘project’, ‘tech-stack’)

content

string

Section content

level?

number = 1

Nesting level (1 = section, 2+ = subsection)

Returns

string


wrapRoot()

wrapRoot(content): string

Defined in: formatters/src/convention-renderer.ts:157

Wrap content with root wrapper if defined.

Parameters

content

string

Returns

string