HtmlInsert Wyam.Html

Queries HTML content of the input documents and inserts new content into the elements that match a query selector.

Note that because this module parses the document content as standards-compliant HTML and outputs the formatted post-parsed DOM, you should only place this module after all other template processing has been performed.

Package

This module exists in the Wyam.Html package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.Html

Usage

  • HtmlInsert(string querySelector, DocumentConfig content)

    Creates the module with the specified query selector.

    • querySelector

      The query selector to use.

    • content

      The content to insert as a delegate that should return a string.

  • HtmlInsert(string querySelector, string content)

    Creates the module with the specified query selector.

    • querySelector

      The query selector to use.

    • content

      The content to insert.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • AtPosition(AdjacentPosition position = 2)

    Specifies where in matching elements the new content should be inserted.

    • position

      A AngleSharp.Dom.AdjacentPosition indicating where the new content should be inserted.

  • First(bool first = true)

    Specifies that only the first query result should be processed (the default is false).

    • first

      If set to true, only the first result is processed.

GitHub