 import UIKit
 
 open class MarkdownParser {
+  public struct EnabledElements: OptionSet {
+    public let rawValue: Int
+
+    public init(rawValue: Int) {
+      self.rawValue = rawValue
+    }
+
+    public static let automaticLink = EnabledElements(rawValue: 1)
+    public static let header        = EnabledElements(rawValue: 1 << 1)
+    public static let list          = EnabledElements(rawValue: 1 << 2)
+    public static let quote         = EnabledElements(rawValue: 1 << 3)
+    public static let link          = EnabledElements(rawValue: 1 << 4)
+    public static let bold          = EnabledElements(rawValue: 1 << 5)
+    public static let italic        = EnabledElements(rawValue: 1 << 6)
+    public static let code          = EnabledElements(rawValue: 1 << 7)
+
+    public static let disabledAutomaticLink: EnabledElements = [
+      .header,
+      .list,
+      .quote,
+      .link,
+      .bold,
+      .italic,
+      .code,
+      ]
+
+    public static let all: EnabledElements = [
+      .disabledAutomaticLink,
+      .automaticLink,
+      ]
+  }
+
 
   // MARK: Element Arrays
   fileprivate var escapingElements: [MarkdownElement]
-  fileprivate var defaultElements: [MarkdownElement]
+  fileprivate var defaultElements: [MarkdownElement] = []
   fileprivate var unescapingElements: [MarkdownElement]
 
   open var customElements: [MarkdownElement]

  fileprivate var unescaping = MarkdownUnescaping()

  // MARK: Configuration
  /// Enables or disables detection of URLs even without Markdown format
  open var automaticLinkDetectionEnabled: Bool = true
  open let font: UIFont

  // MARK: Initializer
  public init(font: UIFont = UIFont.systemFont(ofSize: UIFont.smallSystemFontSize),
              automaticLinkDetectionEnabled: Bool = true,
              customElements: [MarkdownElement] = []) {
    self.font = font


    italic = MarkdownItalic(font: font)
    code = MarkdownCode(font: font)

    self.escapingElements = [codeEscaping, escaping]
    self.unescapingElements = [code, unescaping]
    self.customElements = customElements
    self.enabledElements = enabledElements
    updateDefaultElements()
  }

  // MARK: Element Extensibility
