Attributes for Generating HTML

These document-wide attributes provide control over the form of generated HTML—you use them only for writing HTML

Overview

excludedElements allows control over the tags used. The recognized values in the excludedElements array are (case-insensitive) HTML tags, plus DOCTYPE (representing a doctype declaration) and XML (representing an XML declaration). By default, if this attribute is not present, the excluded elements will be those deprecated in HTML 4 (APPLET, BASEFONT, CENTER, DIR, FONT, ISINDEX, MENU, S, STRIKE, and U) plus XML. If XML is on the list, HTML forms are used; if XML is not on the list, XHTML forms are used where there is a distinction. Either characterEncoding or textEncodingName may be used to control the encoding used for generated HTML; character entities are used for characters not representable in the specified encoding. prefixSpaces allows some control over formatting.

Topics

Constants

static let excludedElements: NSAttributedString.DocumentAttributeKey

An NSArray object containing NSString objects, representing HTML elements not to be used in generated HTML.

static let textEncodingName: NSAttributedString.DocumentAttributeKey

An NSString object containing the name, IANA or otherwise, of a text encoding to be used; mutually exclusive with characterEncoding.

static let prefixSpaces: NSAttributedString.DocumentAttributeKey

An NSNumber object containing an integer (default 0) representing the number of spaces per level by which to indent certain nested HTML elements.