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.
childrenKeyThe 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
nullwhich 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.headingKeyThe key to use for the heading content.
-
WithIdKey(string idKey)Sets the key to use in the heading documents to store the heading
idattribute (if it has one).idKeyThe 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).
levelThe deepest heading level to get.
-
WithLevelKey(string levelKey)Sets the key to use in the heading documents to store the level.
levelKeyThe key to use for the level.
-
WithMetadataKey(string metadataKey)Allows you to specify an alternate metadata key for the heading documents.
metadataKeyThe 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.
nestingtrueto turn on nesting
-
WithParentKey(string parentKey)Sets the key to use in the heading documents to store the parent of a given heading.
parentKeyThe 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`1The child heading documents of the current heading document.
-
HtmlKeys.Headings:IReadOnlyList<IDocument>Documents that represent the headings in each input document.
-
HtmlKeys.Id:System.StringThe value of the
idattribute of the current heading document if the heading contains one. -
HtmlKeys.Level:System.Int32The level of the heading of the current heading document.
-
Keys.Parent:Wyam.Common.Documents.IDocumentThe parent heading document of the current heading document.
