Skip Navigation
Structure

Markdown

Property wrapper to turn any Markdown variable into HTML.
@propertyWrapper
struct Markdown

Overview

Basic usage.

struct Content {
    @Markdown var body: String
}


let content = Content(body: "# Hello")


// Automatic HTML conversion.
print(content.body) // "<h1>Hello</h1>"

Advanced usage.

struct Content {
    @Markdown(
        options: [.validateUTF8, .unsafe],
        extensions: [.strikethrough, .tasklist]
    ) var body: String
}


let content = Content(body: "# Hello")


// Automatic HTML conversion.
print(content.body) // "<h1>Hello</h1>"


// Retrieve the original Markdown.
print(content.$body) // "# Hello"

Topics

Current page is Markdown