IReadOnlyList<IDocument>
in the metadata of each input document. The new heading documents contain metadata with the level of the heading,
the children of the heading (the following headings with one deeper level) and optionally the heading content, which
is also set as the content of each document. The output of this module is the input documents with the additional
metadata value containing the documents that present each heading.
Package
#n Wyam.Html
Usage
-
Headings()
-
Headings(int level)
Fluent Methods
Chain these methods together after the constructor to modify behavior.
-
WithChildrenKey(string childrenKey)
Sets the key to use in the heading documents to store the children of a given heading. In other words, the metadata for this key will contain all the headings following the one in the document with a level one deeper than the current heading.
childrenKey
The key to use for children.
-
WithHeadingKey(string headingKey)
Sets the key to use for storing the heading content in the heading documents. The default is
null
which means only store the heading content in the content of the heading document. Setting this can be useful when you want to use the heading documents in downstream modules, setting their content to something else while maintaining the heading content in metadata.headingKey
The key to use for the heading content.
-
WithIdKey(string idKey)
Sets the key to use in the heading documents to store the heading
id
attribute (if it has one).idKey
The key to use for the
id
.
-
WithLevel(int level)
Sets the deepest heading level to get. The default is to only query for top-level headings (level 1).
level
The deepest heading level to get.
-
WithLevelKey(string levelKey)
Sets the key to use in the heading documents to store the level.
levelKey
The key to use for the level.
-
WithMetadataKey(string metadataKey)
Allows you to specify an alternate metadata key for the heading documents.
metadataKey
The metadata key to store the heading documents in.
-
WithNesting(bool nesting = true)
Controls whether the heading documents are nested. If nesting is used, only the level 1 headings will be in the root set of documents. The rest of the heading documents will only be accessible via the metadata of the root heading documents.
nesting
true
to turn on nesting
-
WithParentKey(string parentKey)
Sets the key to use in the heading documents to store the parent of a given heading.
parentKey
The key to use for the parent.
Output Metadata
The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.
-
Keys.Children
:System.Collections.Generic.IReadOnlyCollection`1
The child heading documents of the current heading document.
-
HtmlKeys.Headings
:IReadOnlyList<IDocument>
Documents that represent the headings in each input document.
-
HtmlKeys.Id
:System.String
The value of the
id
attribute of the current heading document if the heading contains one. -
HtmlKeys.Level
:System.Int32
The level of the heading of the current heading document.
-
Keys.Parent
:Wyam.Common.Documents.IDocument
The parent heading document of the current heading document.