Section » section
section(name) → Section or null
section(name, options) → Section or null
Retrieve the subsection with the specified name from this current section.
eno# content
title: A Manifest
# notes
javascriptconst document = eno.parse(input);
document.section('content'); // returns [object Section name="content" elements=1]
document.section('notes'); // returns [object Section name="notes" elements=0]
document.section('metadata'); // throws an error
document.section('metadata', { required: false }); // returns null
document.section('notes', { enforceElement: true }); // returns [object Section name="notes" elements=0]
document.section('metadata', { enforceElement: true }); // throws an error
Parameters
nameA string specifying the name of the section to retrieve.
optionsenforceElement
Whether the section must be present in the document (defaults to false
)
required
Alias for enforceElement
(this exists on many methods and depending on context refers to either element or value)
Return value
An Section
, or null
.