Compare commits

...

9 Commits

Author SHA1 Message Date
Simon Fairbairn eb63a4ea5e Updating podspec 2016-04-08 10:18:08 +07:00
Simon Fairbairn aa01b6bc58 Version Bump to 13 2016-04-08 10:18:07 +07:00
Simon Fairbairn 37f08f09ae Updating build 2016-04-08 10:17:53 +07:00
Simon Fairbairn c96f17edd0 Merge pull request #10 from mightea/fix-swift3-warnings
Fix swift3 warnings. Thanks to @mightea.
2016-04-08 10:13:41 +07:00
Tobias Herrmann 6288214d26 adds .DS_Store to gitignore 2016-04-07 13:40:03 +02:00
Tobias Herrmann 66f5db3d74 fixes various Swift 3.0 depreciation warnings 2016-04-07 13:38:14 +02:00
Simon Fairbairn 057cf6a4e9 Merge pull request #9 from ravidsrk/patch-1
Added code syntax highlighting to Readme.
2016-04-06 15:45:27 +07:00
Ravindra Kumar 1a4cfe06aa Added code syntax highlighting to Readme 2016-04-04 09:00:16 -04:00
Simon Fairbairn 455a844912 Fixing incorrect homepage 2016-03-23 12:56:32 +07:00
9 changed files with 343 additions and 333 deletions
+3
View File
@@ -61,3 +61,6 @@ Carthage/Build
fastlane/report.xml
fastlane/screenshots
# OS X
.DS_Store
+15 -14
View File
@@ -5,25 +5,26 @@ SwiftyMarkdown converts Markdown files and strings into NSAttributedString using
## Usage
Text string
let md = SwiftyMarkdown(string: "# Heading\nMy *Markdown* string")
md.attributedString()
```swift
let md = SwiftyMarkdown(string: "# Heading\nMy *Markdown* string")
md.attributedString()
```
URL
if let url = NSBundle.mainBundle().URLForResource("file", withExtension: "md"), md = SwiftyMarkdown(url: url ) {
md.attributedString()
}
```swift
if let url = NSBundle.mainBundle().URLForResource("file", withExtension: "md"), md = SwiftyMarkdown(url: url ) {
md.attributedString()
}
```
## Customisation
```swift
md.body.fontName = "AvenirNextCondensed-Medium"
md.body.fontName = "AvenirNextCondensed-Medium"
md.h1.color = UIColor.redColor()
md.h1.fontName = "AvenirNextCondensed-Bold"
md.h1.color = UIColor.redColor()
md.h1.fontName = "AvenirNextCondensed-Bold"
```
md.italic.color = UIColor.blueColor()
## Screenshot
![Screenshot](http://f.cl.ly/items/12332k3f2s0s0C281h2u/swiftymarkdown.png)
![Screenshot](http://f.cl.ly/items/12332k3f2s0s0C281h2u/swiftymarkdown.png)
+308 -301
View File
@@ -9,305 +9,312 @@ XCPlaygroundPage.currentPage.liveView = containerView
let label = UITextView(frame: containerView.frame)
containerView.addSubview(label)
public protocol FontProperties {
var fontName : String { get set }
var color : UIColor { get set }
//
//public protocol FontProperties {
// var fontName : String { get set }
// var color : UIColor { get set }
//}
//
//
//public struct BasicStyles : FontProperties {
// public var fontName = UIFont.preferredFontForTextStyle(UIFontTextStyleBody).fontName
// public var color = UIColor.blackColor()
//}
//
//enum LineType : Int {
// case H1, H2, H3, H4, H5, H6, Body, Italic, Bold, Code
//}
//
//
//public class SwiftyMarkdown {
//
// public var h1 = BasicStyles()
// public var h2 = BasicStyles()
// public var h3 = BasicStyles()
// public var h4 = BasicStyles()
// public var h5 = BasicStyles()
// public var h6 = BasicStyles()
//
// public var body = BasicStyles()
// public var link = BasicStyles()
// public var italic = BasicStyles()
// public var code = BasicStyles()
// public var bold = BasicStyles()
//
// let string : String
// let instructionSet = NSCharacterSet(charactersInString: "\\*_`")
//
// public init(string : String ) {
// self.string = string
// }
//
// public init?(url : NSURL ) {
//
// do {
// self.string = try NSString(contentsOfURL: url, encoding: NSUTF8StringEncoding) as String
//
// } catch {
// self.string = ""
// fatalError("Couldn't read string")
// return nil
// }
// }
//
// public func attributedString() -> NSAttributedString {
// let attributedString = NSMutableAttributedString(string: "")
//
// let lines = self.string.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet())
//
// var lineCount = 0
//
// let headings = ["# ", "## ", "### ", "#### ", "##### ", "###### "]
//
//
// var skipLine = false
// for line in lines {
// lineCount++
// if skipLine {
// skipLine = false
// continue
// }
// var headingFound = false
// for heading in headings {
//
// if let range = line.rangeOfString(heading) where range.startIndex == line.startIndex {
//
// let startHeadingString = line.stringByReplacingCharactersInRange(range, withString: "")
// let endHeadingHash = " " + heading.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
//
// let finalHeadingString = startHeadingString.stringByReplacingOccurrencesOfString(endHeadingHash, withString: "")
//
// // Make Hx where x == current index
// let string = attributedStringFromString(finalHeadingString, withType: LineType(rawValue: headings.indexOf(heading)!)!)
// attributedString.appendAttributedString(string)
// headingFound = true
// }
// }
// if headingFound {
// continue
// }
//
//
// if lineCount < lines.count {
// let nextLine = lines[lineCount]
//
// if let range = nextLine.rangeOfString("=") where range.startIndex == nextLine.startIndex {
// // Make H1
// let string = attributedStringFromString(line, withType: .H1)
// attributedString.appendAttributedString(string)
// skipLine = true
// continue
// }
//
// if let range = nextLine.rangeOfString("-") where range.startIndex == nextLine.startIndex {
//
//
// // Make H1
// let string = attributedStringFromString(line, withType: .H2)
// attributedString.appendAttributedString(string)
// skipLine = true
// continue
// }
// }
//
// if line.characters.count > 0 {
//
// let scanner = NSScanner(string: line)
//
//
// scanner.charactersToBeSkipped = nil
//
// while !scanner.atEnd {
//
// var followingString : NSString?
// var string : NSString?
// // Get all the characters up to the ones we are interested in
// if scanner.scanUpToCharactersFromSet(instructionSet, intoString: &string) {
// if let hasString = string as? String {
// let bodyString = attributedStringFromString(hasString, withType: .Body)
// attributedString.appendAttributedString(bodyString)
//
// var matchedCharacters = self.tagFromScanner(scanner)
//
//
// let location = scanner.scanLocation
// // If the next string after the characters is a space, then add it to the final string and continue
// if !scanner.scanUpToString(" ", intoString: nil) {
//
// let charAtts = attributedStringFromString(matchedCharacters, withType: .Body)
//
// attributedString.appendAttributedString(charAtts)
// } else {
// scanner.scanLocation = location
// scanner.scanUpToCharactersFromSet(instructionSet, intoString: &followingString)
// if let hasString = followingString as? String {
// let attString : NSAttributedString
//
// if matchedCharacters.containsString("\\") {
// attString = attributedStringFromString(matchedCharacters + hasString, withType: .Body)
// } else if matchedCharacters == "**" || matchedCharacters == "__" {
// attString = attributedStringFromString(hasString, withType: .Bold)
// } else {
// attString = attributedStringFromString(hasString, withType: .Italic)
// }
// attributedString.appendAttributedString(attString)
// }
// matchedCharacters = self.tagFromScanner(scanner)
//
// if matchedCharacters.containsString("\\") {
// let attString = attributedStringFromString(matchedCharacters, withType: .Body)
//
// attributedString.appendAttributedString(attString)
// }
//
// }
// }
// } else {
// var matchedCharacters = self.tagFromScanner(scanner)
//
// scanner.scanUpToCharactersFromSet(instructionSet, intoString: &followingString)
// if let hasString = followingString as? String {
// let attString : NSAttributedString
//
// if matchedCharacters.containsString("\\") {
// attString = attributedStringFromString(matchedCharacters + hasString, withType: .Body)
// } else if matchedCharacters == "**" || matchedCharacters == "__" {
// attString = attributedStringFromString(hasString, withType: .Bold)
// } else {
// attString = attributedStringFromString(hasString, withType: .Italic)
// }
// attributedString.appendAttributedString(attString)
// }
// matchedCharacters = self.tagFromScanner(scanner)
//
// if matchedCharacters.containsString("\\") {
// let attString = attributedStringFromString(matchedCharacters, withType: .Body)
//
// attributedString.appendAttributedString(attString)
// }
//
// }
// }
// }
// attributedString.appendAttributedString(NSAttributedString(string: "\n"))
// }
//
// return attributedString
// }
//
// func tagFromScanner( scanner : NSScanner ) -> String {
// var matchedCharacters : String = ""
// var tempCharacters : NSString?
//
// // Scan the ones we are interested in
// while scanner.scanCharactersFromSet(instructionSet, intoString: &tempCharacters) {
// if let chars = tempCharacters as? String {
// matchedCharacters = matchedCharacters + chars
// }
// }
// return matchedCharacters
// }
//
//
// // Make H1
//
// func attributedStringFromString(string : String, withType type : LineType ) -> NSAttributedString {
// var attributes : [String : AnyObject]
// let textStyle : String
// let fontName : String
//
// var appendNewLine = true
//
// switch type {
// case .H1:
// fontName = h1.fontName
//
// if #available(iOS 9, *) {
// textStyle = UIFontTextStyleTitle1
// }
// attributes = [NSForegroundColorAttributeName : h1.color]
// case .H2:
// fontName = h2.fontName
// textStyle = UIFontTextStyleTitle2
// attributes = [NSForegroundColorAttributeName : h2.color]
// case .H3:
// fontName = h3.fontName
// textStyle = UIFontTextStyleTitle3
// attributes = [NSForegroundColorAttributeName : h3.color]
// case .H4:
// fontName = h4.fontName
// textStyle = UIFontTextStyleHeadline
// attributes = [NSForegroundColorAttributeName : h4.color]
// case .H5:
// fontName = h5.fontName
// textStyle = UIFontTextStyleSubheadline
// attributes = [NSForegroundColorAttributeName : h5.color]
// case .H6:
// fontName = h6.fontName
// textStyle = UIFontTextStyleFootnote
// attributes = [NSForegroundColorAttributeName : h6.color]
// case .Italic:
// fontName = italic.fontName
// attributes = [NSForegroundColorAttributeName : italic.color]
// textStyle = UIFontTextStyleBody
// appendNewLine = false
// case .Bold:
// fontName = bold.fontName
// attributes = [NSForegroundColorAttributeName : bold.color]
// appendNewLine = false
// textStyle = UIFontTextStyleBody
// default:
// appendNewLine = false
// fontName = body.fontName
// textStyle = UIFontTextStyleBody
// attributes = [NSForegroundColorAttributeName:body.color]
// break
// }
//
// let font = UIFont.preferredFontForTextStyle(textStyle)
// let styleDescriptor = font.fontDescriptor()
// let styleSize = styleDescriptor.fontAttributes()[UIFontDescriptorSizeAttribute] as? CGFloat ?? CGFloat(14)
//
// var finalFont : UIFont
// if let font = UIFont(name: fontName, size: styleSize) {
// finalFont = font
// } else {
// finalFont = UIFont.preferredFontForTextStyle(textStyle)
// }
//
// let finalFontDescriptor = finalFont.fontDescriptor()
// if type == .Italic {
// let italicDescriptor = finalFontDescriptor.fontDescriptorWithSymbolicTraits(.TraitItalic)
// finalFont = UIFont(descriptor: italicDescriptor, size: styleSize)
// }
// if type == .Bold {
// let boldDescriptor = finalFontDescriptor.fontDescriptorWithSymbolicTraits(.TraitBold)
// finalFont = UIFont(descriptor: boldDescriptor, size: styleSize)
// }
//
//
// attributes[NSFontAttributeName] = finalFont
//
// if appendNewLine {
// return NSAttributedString(string: string + "\n", attributes: attributes)
// } else {
// return NSAttributedString(string: string, attributes: attributes)
// }
// }
//}
//
//if let url = NSBundle.mainBundle().URLForResource("test", withExtension: "md"), md = SwiftyMarkdown(url: url) {
//
// label.attributedText = md.attributedString()
//}
//
let matchedCharacters = "mynew\\Strings"
if let hasRange = matchedCharacters.rangeOfString("\\") {
let newRange = Range(start: hasRange.startIndex, end: hasRange.endIndex.advancedBy(1))
let range = hasRange.startIndex...hasRange.endIndex
}
public struct BasicStyles : FontProperties {
public var fontName = UIFont.preferredFontForTextStyle(UIFontTextStyleBody).fontName
public var color = UIColor.blackColor()
}
enum LineType : Int {
case H1, H2, H3, H4, H5, H6, Body, Italic, Bold, Code
}
public class SwiftyMarkdown {
public var h1 = BasicStyles()
public var h2 = BasicStyles()
public var h3 = BasicStyles()
public var h4 = BasicStyles()
public var h5 = BasicStyles()
public var h6 = BasicStyles()
public var body = BasicStyles()
public var link = BasicStyles()
public var italic = BasicStyles()
public var code = BasicStyles()
public var bold = BasicStyles()
let string : String
let instructionSet = NSCharacterSet(charactersInString: "\\*_`")
public init(string : String ) {
self.string = string
}
public init?(url : NSURL ) {
do {
self.string = try NSString(contentsOfURL: url, encoding: NSUTF8StringEncoding) as String
} catch {
self.string = ""
fatalError("Couldn't read string")
return nil
}
}
public func attributedString() -> NSAttributedString {
let attributedString = NSMutableAttributedString(string: "")
let lines = self.string.componentsSeparatedByCharactersInSet(NSCharacterSet.newlineCharacterSet())
var lineCount = 0
let headings = ["# ", "## ", "### ", "#### ", "##### ", "###### "]
var skipLine = false
for line in lines {
lineCount++
if skipLine {
skipLine = false
continue
}
var headingFound = false
for heading in headings {
if let range = line.rangeOfString(heading) where range.startIndex == line.startIndex {
let startHeadingString = line.stringByReplacingCharactersInRange(range, withString: "")
let endHeadingHash = " " + heading.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet())
let finalHeadingString = startHeadingString.stringByReplacingOccurrencesOfString(endHeadingHash, withString: "")
// Make Hx where x == current index
let string = attributedStringFromString(finalHeadingString, withType: LineType(rawValue: headings.indexOf(heading)!)!)
attributedString.appendAttributedString(string)
headingFound = true
}
}
if headingFound {
continue
}
if lineCount < lines.count {
let nextLine = lines[lineCount]
if let range = nextLine.rangeOfString("=") where range.startIndex == nextLine.startIndex {
// Make H1
let string = attributedStringFromString(line, withType: .H1)
attributedString.appendAttributedString(string)
skipLine = true
continue
}
if let range = nextLine.rangeOfString("-") where range.startIndex == nextLine.startIndex {
// Make H1
let string = attributedStringFromString(line, withType: .H2)
attributedString.appendAttributedString(string)
skipLine = true
continue
}
}
if line.characters.count > 0 {
let scanner = NSScanner(string: line)
scanner.charactersToBeSkipped = nil
while !scanner.atEnd {
var followingString : NSString?
var string : NSString?
// Get all the characters up to the ones we are interested in
if scanner.scanUpToCharactersFromSet(instructionSet, intoString: &string) {
if let hasString = string as? String {
let bodyString = attributedStringFromString(hasString, withType: .Body)
attributedString.appendAttributedString(bodyString)
var matchedCharacters = self.tagFromScanner(scanner)
let location = scanner.scanLocation
// If the next string after the characters is a space, then add it to the final string and continue
if !scanner.scanUpToString(" ", intoString: nil) {
let charAtts = attributedStringFromString(matchedCharacters, withType: .Body)
attributedString.appendAttributedString(charAtts)
} else {
scanner.scanLocation = location
scanner.scanUpToCharactersFromSet(instructionSet, intoString: &followingString)
if let hasString = followingString as? String {
let attString : NSAttributedString
if matchedCharacters.containsString("\\") {
attString = attributedStringFromString(matchedCharacters + hasString, withType: .Body)
} else if matchedCharacters == "**" || matchedCharacters == "__" {
attString = attributedStringFromString(hasString, withType: .Bold)
} else {
attString = attributedStringFromString(hasString, withType: .Italic)
}
attributedString.appendAttributedString(attString)
}
matchedCharacters = self.tagFromScanner(scanner)
if matchedCharacters.containsString("\\") {
let attString = attributedStringFromString(matchedCharacters, withType: .Body)
attributedString.appendAttributedString(attString)
}
}
}
} else {
var matchedCharacters = self.tagFromScanner(scanner)
scanner.scanUpToCharactersFromSet(instructionSet, intoString: &followingString)
if let hasString = followingString as? String {
let attString : NSAttributedString
if matchedCharacters.containsString("\\") {
attString = attributedStringFromString(matchedCharacters + hasString, withType: .Body)
} else if matchedCharacters == "**" || matchedCharacters == "__" {
attString = attributedStringFromString(hasString, withType: .Bold)
} else {
attString = attributedStringFromString(hasString, withType: .Italic)
}
attributedString.appendAttributedString(attString)
}
matchedCharacters = self.tagFromScanner(scanner)
if matchedCharacters.containsString("\\") {
let attString = attributedStringFromString(matchedCharacters, withType: .Body)
attributedString.appendAttributedString(attString)
}
}
}
}
attributedString.appendAttributedString(NSAttributedString(string: "\n"))
}
return attributedString
}
func tagFromScanner( scanner : NSScanner ) -> String {
var matchedCharacters : String = ""
var tempCharacters : NSString?
// Scan the ones we are interested in
while scanner.scanCharactersFromSet(instructionSet, intoString: &tempCharacters) {
if let chars = tempCharacters as? String {
matchedCharacters = matchedCharacters + chars
}
}
return matchedCharacters
}
// Make H1
func attributedStringFromString(string : String, withType type : LineType ) -> NSAttributedString {
var attributes : [String : AnyObject]
let textStyle : String
let fontName : String
var appendNewLine = true
switch type {
case .H1:
fontName = h1.fontName
if #available(iOS 9, *) {
textStyle = UIFontTextStyleTitle1
}
attributes = [NSForegroundColorAttributeName : h1.color]
case .H2:
fontName = h2.fontName
textStyle = UIFontTextStyleTitle2
attributes = [NSForegroundColorAttributeName : h2.color]
case .H3:
fontName = h3.fontName
textStyle = UIFontTextStyleTitle3
attributes = [NSForegroundColorAttributeName : h3.color]
case .H4:
fontName = h4.fontName
textStyle = UIFontTextStyleHeadline
attributes = [NSForegroundColorAttributeName : h4.color]
case .H5:
fontName = h5.fontName
textStyle = UIFontTextStyleSubheadline
attributes = [NSForegroundColorAttributeName : h5.color]
case .H6:
fontName = h6.fontName
textStyle = UIFontTextStyleFootnote
attributes = [NSForegroundColorAttributeName : h6.color]
case .Italic:
fontName = italic.fontName
attributes = [NSForegroundColorAttributeName : italic.color]
textStyle = UIFontTextStyleBody
appendNewLine = false
case .Bold:
fontName = bold.fontName
attributes = [NSForegroundColorAttributeName : bold.color]
appendNewLine = false
textStyle = UIFontTextStyleBody
default:
appendNewLine = false
fontName = body.fontName
textStyle = UIFontTextStyleBody
attributes = [NSForegroundColorAttributeName:body.color]
break
}
let font = UIFont.preferredFontForTextStyle(textStyle)
let styleDescriptor = font.fontDescriptor()
let styleSize = styleDescriptor.fontAttributes()[UIFontDescriptorSizeAttribute] as? CGFloat ?? CGFloat(14)
var finalFont : UIFont
if let font = UIFont(name: fontName, size: styleSize) {
finalFont = font
} else {
finalFont = UIFont.preferredFontForTextStyle(textStyle)
}
let finalFontDescriptor = finalFont.fontDescriptor()
if type == .Italic {
let italicDescriptor = finalFontDescriptor.fontDescriptorWithSymbolicTraits(.TraitItalic)
finalFont = UIFont(descriptor: italicDescriptor, size: styleSize)
}
if type == .Bold {
let boldDescriptor = finalFontDescriptor.fontDescriptorWithSymbolicTraits(.TraitBold)
finalFont = UIFont(descriptor: boldDescriptor, size: styleSize)
}
attributes[NSFontAttributeName] = finalFont
if appendNewLine {
return NSAttributedString(string: string + "\n", attributes: attributes)
} else {
return NSAttributedString(string: string, attributes: attributes)
}
}
}
if let url = NSBundle.mainBundle().URLForResource("test", withExtension: "md"), md = SwiftyMarkdown(url: url) {
label.attributedText = md.attributedString()
}
+2 -2
View File
@@ -1,8 +1,8 @@
Pod::Spec.new do |s|
s.name = "SwiftyMarkdown"
s.version = "0.2.2"
s.version = "0.2.3"
s.summary = "Converts Markdown to NSAttributed String"
s.homepage = "https://github.com/SimonFairbairn/Stormcloud"
s.homepage = "https://github.com/SimonFairbairn/SwiftyMarkdown"
s.license = 'MIT'
s.author = { "Simon Fairbairn" => "simon@voyagetravelapps.com" }
s.source = { :git => "https://github.com/SimonFairbairn/SwiftyMarkdown.git", :tag => s.version }
+4 -4
View File
@@ -249,7 +249,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 13;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -297,7 +297,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 12;
CURRENT_PROJECT_VERSION = 13;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -325,7 +325,7 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 12;
DYLIB_CURRENT_VERSION = 13;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SwiftyMarkdown/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@@ -344,7 +344,7 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 12;
DYLIB_CURRENT_VERSION = 13;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = SwiftyMarkdown/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+2 -2
View File
@@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<string>0.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
+4 -5
View File
@@ -139,7 +139,7 @@ public class SwiftyMarkdown {
var skipLine = false
for theLine in lines {
lineCount++
lineCount += 1
if skipLine {
skipLine = false
continue
@@ -266,8 +266,6 @@ public class SwiftyMarkdown {
let attributedString = attributedStringFromString(results.escapedCharacters, withStyle: style).mutableCopy() as! NSMutableAttributedString
if let hasString = followingString as? String {
let prefix = ( style == .Code && start ) ? "\t" : ""
let attString = attributedStringFromString(prefix + hasString, withStyle: style, attributes: attributes)
attributedString.appendAttributedString(attString)
@@ -293,7 +291,7 @@ public class SwiftyMarkdown {
while matchedCharacters.containsString("\\") {
if let hasRange = matchedCharacters.rangeOfString("\\") {
let newRange = Range(start: hasRange.startIndex, end: hasRange.endIndex.advancedBy(1))
let newRange = hasRange.startIndex...hasRange.endIndex
foundCharacters = foundCharacters + matchedCharacters.substringWithRange(newRange)
matchedCharacters.removeRange(newRange)
@@ -308,9 +306,10 @@ public class SwiftyMarkdown {
// Make H1
func attributedStringFromString(string : String, withStyle style : LineStyle, var attributes : [String : AnyObject] = [:] ) -> NSAttributedString {
func attributedStringFromString(string : String, withStyle style : LineStyle, attributes : [String : AnyObject] = [:] ) -> NSAttributedString {
let textStyle : String
var fontName : String?
var attributes = attributes
// What type are we and is there a font name set?
+2 -2
View File
@@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.2.1</string>
<string>0.2.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
</dict>
</plist>
+3 -3
View File
@@ -24,6 +24,6 @@ fastlane ios initial
----
This README.md is auto-generated and will be re-generated every time to run [fastlane](https://fastlane.tools).
More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [GitHub](https://github.com/fastlane/fastlane).
This README.md is auto-generated and will be re-generated every time to run [fastlane](https://fastlane.tools).
More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [GitHub](https://github.com/fastlane/fastlane/tree/master/fastlane).