Section
A Section is a single node in a PromptObjectModel tree. Each section
has a title, optional body text, optional bullet points, and any number of
nested subsections.
Constructor
title
Section title. null is permitted only on the very first top-level section
of a model.
opts
Optional section content.
opts.body
Section body text.
opts.bullets
List of bullet point strings.
opts.numbered
Whether this section is numbered when rendered.
opts.numberedBullets
Whether bullet points are rendered as a numbered list instead of using bullet markers.
Properties
title
Section heading text, or null if untitled.
body
Section body paragraph text.
bullets
List of bullet point strings.
subsections
Nested child sections.
numbered
Whether this section is numbered when rendered.
numberedBullets
Whether bullet points are rendered as a numbered list.
Methods
addBody
Set or replace the body text for this section.
body
The body paragraph text.
addBullets
Append bullet points to this section, extending the existing list.
bullets
Bullet point strings to add.
addSubsection
Add a titled subsection to this section and return it. Subsections must have a title.
title
Subsection title.
opts
Optional body, bullets, numbered, and numberedBullets for the
subsection.
Returns the newly created Section.
toDict
Convert this section (and its subsections) to a plain
SectionData object.
renderMarkdown
Render this section and its subsections as Markdown.
level
The heading level to start at (2 renders a ## heading).
sectionNumber
The current section number used for numbered sections.
renderXml
Render this section and its subsections as XML.
indent
The indentation level to start at.
sectionNumber
The current section number used for numbered sections.