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 HTML escaped for better compatibility with downstream Razor modules. If you want to include a raw @ symbol when EscapeAt() is true, use \@. 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

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. If you want to include a raw @ symbol when EscapeAt() is true, use \@.

    • escapeAt

      If set to true, @ symbols are HTML escaped.

  • PrependLinkRoot(bool prependLinkRoot = false)

    Specifies if the Wyam.Common.Meta.Keys.LinkRoot setting must be used to rewrite root-relative links when rendering markdown. By default, root-relative links, which are links starting with a '/' are left untouched. When setting this value to true, the Wyam.Common.Meta.Keys.LinkRoot setting value is added before the link.

    • prependLinkRoot

      If set to true, the Wyam.Common.Meta.Keys.LinkRoot setting value is added before any root-relative link (eg. stating with a '/').

  • 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.

  • UseExtension<TExtension>(TExtension extension) where TExtension : IMarkdownExtension

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

    • extension

      A object that that implement Markdig.IMarkdownExtension.

  • 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 Markdig.IMarkdownExtension interface.

    • extensions

      A sequence of types that implement Markdig.IMarkdownExtension.

GitHub