Document_ParsingOptions_Position_Error_RenderingFormat_RenderingOptions - SwiftDocOrg/CommonMark GitHub Wiki
Document.ParsingOptions.Position.Error.RenderingFormat.RenderingOptions
Options for rendering a CommonMark document.
public struct RenderingOptions: OptionSet
Inheritance
OptionSet
Initializers
init(rawValue:)
public init(rawValue: Int32 = CMARK_OPT_DEFAULT)
Properties
noBreaks
Render softbreak elements as spaces.
let noBreaks = RenderingOptions(rawValue: CMARK_OPT_NOBREAKS)
Important: This option has no effect when rendering XML.
hardBreaks
Render softbreak elements as hard line breaks.
let hardBreaks = RenderingOptions(rawValue: CMARK_OPT_HARDBREAKS)
Important: This option has no effect when rendering XML.
includeSourcePosition
Include a data-sourcepos attribute on all block elements
to map the rendered output to the source input.
let includeSourcePosition = RenderingOptions(rawValue: CMARK_OPT_SOURCEPOS)
Important: This option has an effect only when rendering HTML or XML.
unsafe
Render raw HTML and "unsafe" links.
let unsafe = RenderingOptions(rawValue: CMARK_OPT_UNSAFE)
A link is considered to be "unsafe"
if its scheme is javascript:, vbscript:, or file:,
or if its scheme is data:
and the MIME type of the encoded data isn't one of the following:
By default, raw HTML is replaced by a placeholder HTML comment. Unsafe links are replaced by empty strings.
Important: This option has an effect only when rendering HTML.
rawValue
var rawValue: Int32
Methods
render(format:options:width:)
Render a document into a given format with the specified options.
public func render(format: RenderingFormat, options: RenderingOptions = [], width: Int = 0) -> String
Parameters
- format: The rendering format
- options: The rendering options
- width: The column width used to wrap lines for rendered output (
.commonmark,.man, and.latexformats only). Must be a positive number. Pass0to prevent line wrapping.
Returns
The rendered text.
<(lhs:rhs:)
public static func <(lhs: Document.Position, rhs: Document.Position) -> Bool