SemText

Reference · NPL

<npl-section>

NPL element

PromptLingo reference ↗

Known section types get a matching header; unknown types get a warning style so a typo is easy to spot. The content stays plain text, so search and copy still work.

A labelled section for any NPL prompt block. Known section types get a matching header; unknown types get a warning style so a typo is easy to spot. The content stays plain text, so search and copy still work. required. One of the known section types: `alg`, `alg-pseudo`, `diagram`, `example`, `format`, `logic`, `note`, `syntax`, `template`. per the global attribute catalog (conventions.md §2) per the global attribute catalog (conventions.md §2) per the global attribute catalog (conventions.md §2)

Example

npl-section.html
source
1 <npl-section type="syntax">
2 <pre><code>section := "&lt;npl-section" type "&gt;" body "&lt;/npl-section&gt;"</code></pre>
3 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="alg"

The generated header reads Algorithm — same chrome as every known type; only the label and the derived `npl-section-alg` host class differ.

variant: type="alg"
npl-section-alg.html
source
1 <npl-section type="alg">
2 <ol>
3 <li>Resolve the type in either spelling.</li>
4 <li>Insert the labelled header as the first child.</li>
5 </ol>
6 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="alg-pseudo"

The Pseudocode label; the body prose is never rewritten.

variant: type="alg-pseudo"
npl-section-alg-pseudo.html
source
1 <npl-section type="alg-pseudo">
2 <p>for each authored section:
3 <p>resolve the type, then insert the labelled header</p>
4 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="diagram"

The Diagram label; diagrams stay authored content — the component never draws.

variant: type="diagram"
npl-section-diagram.html
source
1 <npl-section type="diagram">
2 <pre>header ─┬─ label
3 └─ body (untouched)</pre>
4 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="example"

The Example header.

variant: type="example"
npl-section-example.html
source
1 <npl-section type="example">
2 <p>A worked case authored in the body; the header names it without restating it.</p>
3 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="format"

The Format label.

variant: type="format"
npl-section-format.html
source
1 <npl-section type="format">
2 <p>Header: generated. Body: authored HTML, untouched.</p>
3 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="logic"

The Logic label.

variant: type="logic"
npl-section-logic.html
source
1 <npl-section type="logic">
2 <p>known(type) → header + derived class
3 <p>unknown(type) → warning class, no header</p>
4 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="note"

A known type that stays a plain labelled section — callout behaviour (collapse, role, variant) belongs to sem-note and is not duplicated here.

variant: type="note"
npl-section-note.html
source
1 <npl-section type="note">
2 Renders as a plain labelled section; nothing hides and nothing collapses.
3 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: type="template"

The Template label.

variant: type="template"
npl-section-template.html
source
1 <npl-section type="template">
2 &lt;npl-section type="<em>known-type</em>"&gt;…body…&lt;/npl-section&gt;
3 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

variant: unknown type

An unknown value is never fatal: no header renders, `npl-section-warning` lands on the host, the body reads as plain prose, and one author-facing console warning names the value.

variant: unknown type
npl-section-unknown-type.html
source
1 <npl-section type="mnemonic">
2 Content renders plain — the unknown value affects only chrome and the console warning.
3 </npl-section>
render

Live render boots with JavaScript — the authored source is alongside.

Source: spec/schema/npl/npl-section.md