Markdown Wyam.Markdown

Parses markdown content and renders it to HTML.
Parses markdown content in each input document and outputs documents with rendered HTML content. Note that @ (at) symbols will be automatically escaped for better compatibility with downstream Razor modules. Use the EscapeAt() fluent method to modify this behavior.

Package

This module exists in the Wyam.Markdown package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.Markdown
Alternativly, you can add all modules at once with the following preprocessor directive:
#n Wyam.All

Usage

  • Markdown()

    Processes Markdown in the content of the document.

  • Markdown(string sourceKey, string destinationKey = null)

    Processes Markdown in the metadata of the document. The rendered HTML will be placed

    • sourceKey

      The metadata key of the Markdown to process.

    • destinationKey

      The metadata key to store the rendered HTML (if null, it gets placed back in the source metadata key).

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • EscapeAt(bool escapeAt = true)

    Specifies whether the @ symbol should be escaped (the default is true). This is important if the Markdown documents are going to be passed to the Razor module, otherwise the Razor processor will interpret the unescaped @ symbols as code directives.

    • escapeAt

      If set to true, @ symbols are HTML escaped.

  • UseConfiguration(string extensions)

    Includes a set of extensions defined as a string, e.g., "pipetables", "citations", "mathematics", or "abbreviations". Separate different extensions with a '+'.

    • extensions

      The extensions string.

  • UseExtension<TExtension>() where TExtension : class, IMarkdownExtension, new()

    Includes a custom extension in the markdown processing given by a class implementing the IMarkdownExtension interface.

  • UseExtensions()

    Includes a set of useful advanced extensions, e.g., citations, footers, footnotes, math, grid-tables, pipe-tables, and tasks, in the Markdown processing pipeline.

  • UseExtensions(IEnumerable<Type> extensions)

    Includes multiple custom extension in the markdown processing given by classes implementing the IMarkdownExtension interface.

    • extensions

      A sequence of types that implement IMarkdownExtension.

GitHub