diff --git a/README.md b/README.md index 4873ec7..34de13e 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,9 @@ strikethrough.fontStyle : FontStyle underlineLinks : Bool bullet : String + +listInterval : CGFloat +blockIndent : CGFloat ``` `FontStyle` is an enum with these cases: `normal`, `bold`, `italic`, and `bolditalic` to give you more precise control over how lines and character styles should look. For example, perhaps you want blockquotes to default to having the italic style: diff --git a/Sources/SwiftyMarkdown/SwiftyMarkdown.swift b/Sources/SwiftyMarkdown/SwiftyMarkdown.swift index 09d1052..4436d43 100644 --- a/Sources/SwiftyMarkdown/SwiftyMarkdown.swift +++ b/Sources/SwiftyMarkdown/SwiftyMarkdown.swift @@ -247,6 +247,10 @@ If that is not set, then the system default will be used. open var strikethrough = BasicStyles() public var bullet : String = "・" + + public var listInterval: CGFloat = 30 + + public var blockIndent: CGFloat = 20 public var underlineLinks : Bool = false @@ -498,17 +502,17 @@ extension SwiftyMarkdown { case .codeblock: lineProperties = body let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.firstLineHeadIndent = 20.0 + paragraphStyle.firstLineHeadIndent = self.blockIndent attributes[.paragraphStyle] = paragraphStyle case .blockquote: lineProperties = self.blockquotes let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.firstLineHeadIndent = 20.0 - paragraphStyle.headIndent = 20.0 + paragraphStyle.firstLineHeadIndent = self.blockIndent + paragraphStyle.headIndent = self.blockIndent attributes[.paragraphStyle] = paragraphStyle case .unorderedList, .unorderedListIndentFirstOrder, .unorderedListIndentSecondOrder, .orderedList, .orderedListIndentFirstOrder, .orderedListIndentSecondOrder: - let interval : CGFloat = 30 + let interval : CGFloat = self.listInterval var addition = interval var indent = "" switch line.lineStyle as! MarkdownLineStyle {