Description Details Fields Methods
The level of a Markdown section headers is indicated using
hashes in front of the title. YAML frontmatter allows for
to specify section header numbering, but it is not clear
how to mix headers with and without numbers in the same
document. The SectionEnumerator
reference class allows
us to specify section header numbers only for certain titles.
The main method of a SectionEnumerator reference object
is displayNumSection
. This takes as input a string
of an unnumbered section, parses that string and computes
the section number based on the number of hashes. For some
reason, the option number_sections = FALSE
does not
work for top level sections, but it only works for subsections.
As a work-around, all sections are moved down one level to subsections
by ignoring a given number of nNrExtraHash
hash signs.
Hence a subsection will be numbered as a section and a subsubsection
will be numbered as a subsection etc.
sUnNumSection
original ununmbered section string
rcSectionCount
reference object representing section count
sHash
hashes of caption
sRemCaption
remaining caption after removing hashes
sNumCaptionResult
resulting caption string with number
sSectionSplit
split character between number and title
nNrExtraHash
number of extra hashes not used for section counts
displayNumSection(psUnNumSection = NULL, pnNrExtraHash = NULL)
Parsing of unnumbered section string and display the string including the section number
initialize()
Initalisation of object fields
parseUnNumSection()
Parse the unnumbered section string and assign the object fields
setUnNumSection(psUnNumSection)
Setter for unnumbered section string
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.