MarkdownOptions

public struct MarkdownOptions : RenderingOptions

Rendering options for KituraMarkdown, allowing the generated HTML to be wrapped in a page template. The page template should contain <snippetInsertLocation></snippetInsertLocation>, which will be substituted with the generated HTML content.

Note: If you do not wish to customize the page template, "default" can be specified.

Usage Example:

let markdownOptions = MarkdownOptions(pageTemplate: "<!DOCTYPE html><html lang=\"en\"><head><meta charset=\"UTF-8\"></head><body><div><snippetInsertLocation></snippetInsertLocation></div></body></html>")

router.add(templateEngine: KituraMarkdown())

router.get("/docs") { _, response, next in
    try response.render("Example.md", context: [String:Any](), options: markdownOptions)
    response.status(.OK)
    next()
}
  • Create a MarkdownOptions that specifies a custom HTML page template, into which the generated HTML content will be inserted.

    Declaration

    Swift

    public init(pageTemplate: String)

    Parameters

    pageTemplate

    String form of page template.