-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from brokenhandsio/master
Update for GFM
- Loading branch information
Showing
10 changed files
with
66 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
/.build | ||
/Packages | ||
/*.xcodeproj | ||
Package.pins | ||
DerivedData/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
os: | ||
- linux | ||
- osx | ||
- linux | ||
- osx | ||
language: generic | ||
sudo: required | ||
dist: trusty | ||
osx_image: xcode8 | ||
install: | ||
- eval "$(curl -sL https://gist.githubusercontent.com/kylef/5c0475ff02b7c7671d2a/raw/02090c7ede5a637b76e6df1710e83cd0bbe7dcdf/swiftenv-install.sh)" | ||
|
||
osx_image: xcode8.3 | ||
before_install: | ||
- if [ $TRAVIS_OS_NAME == "osx" ]; then | ||
brew tap vapor/tap; | ||
brew update; | ||
brew install vapor; | ||
else | ||
eval "$(curl -sL https://apt.vapor.sh)"; | ||
sudo apt-get install vapor; | ||
sudo chmod -R a+rx /usr/; | ||
fi | ||
|
||
script: | ||
- swift build | ||
- swift test | ||
- swift build | ||
- swift build -c release | ||
- swift test | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: change | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "cmark.swift", | ||
targets: [ | ||
Target(name: "cmark.swift-example", dependencies: ["cmark.swift"]) | ||
], | ||
name: "SwiftMarkdown", | ||
dependencies: [ | ||
.Package(url: "https://github.com/czechboy0/cmark.git", "0.26.1") | ||
.Package(url: "https://github.com/brokenhandsio/cmark-gfm.git", majorVersion: 1) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
# cmark.swift | ||
# SwiftMarkdown | ||
|
||
[![Build Status](https://travis-ci.org/czechboy0/cmark.swift.svg?branch=master)](https://travis-ci.org/czechboy0/cmark.swift) | ||
[![Latest Release](https://img.shields.io/github/release/czechboy0/cmark.swift.svg)](https://github.com/czechboy0/cmark.swift/releases/latest) | ||
![Platforms](https://img.shields.io/badge/platforms-Linux%20%7C%20OS%20X-blue.svg) | ||
![Package Managers](https://img.shields.io/badge/package%20managers-SwiftPM-yellow.svg) | ||
[![Language](https://img.shields.io/badge/Swift-3-brightgreen.svg)](http://swift.org) | ||
[![Build Status](https://travis-ci.org/vapor-community/markdown.svg?branch=master)](https://travis-ci.org/vapor-community/markdown) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/vapor-community/markdown/master/LICENSE) | ||
|
||
[![Blog](https://img.shields.io/badge/blog-honzadvorsky.com-green.svg)](http://honzadvorsky.com) | ||
[![Twitter Czechboy0](https://img.shields.io/badge/twitter-czechboy0-green.svg)](http://twitter.com/czechboy0) | ||
|
||
> Swift cmark wrapper for SwiftPM | ||
Very simple Swift wrapper of [cmark](https://github.com/jgm/cmark). Uses a [fork](https://github.com/czechboy0/cmark) of cmark which has been adapted for building with SwiftPM. | ||
Very simple Swift wrapper of Github's fork of [cmark](https://github.com/github/cmark). Uses a [fork](https://github.com/brokenhandsio/cmark-gfm) of cmark which has been adapted for building with SwiftPM. | ||
|
||
# Usage | ||
|
||
## markdown -> HTML | ||
|
||
```swift | ||
let markdown = "# Hello" | ||
let html = try markdownToHTML(markdown, options: []) | ||
print(html) //"<h1>Hello</h1>\n" | ||
let html = try markdownToHTML(markdown) | ||
print(html) // This will return "<h1>Hello</h1>\n" | ||
``` | ||
|
||
# Installation | ||
## Options | ||
|
||
## Swift Package Manager | ||
You can pass different options to the underlying `cmark` library. By default `safe` is passed, but this can be explicitly done with: | ||
|
||
```swift | ||
.Package(url: "https://github.com/czechboy0/cmark.swift.git", majorVersion: 0, minor: 1) | ||
let html = try markdownToHTML(markdown, options: [.safe]) | ||
``` | ||
|
||
:gift_heart: Contributing | ||
------------ | ||
Please create an issue with a description of your problem or open a pull request with a fix. | ||
The available options are: | ||
|
||
* sourcePosition | ||
* hardBreaks | ||
* safe | ||
* noBreaks | ||
* normalize | ||
* validateUTF8 | ||
* smartQuotes | ||
|
||
:v: License | ||
------- | ||
MIT | ||
For more information on the available options, see [`cmark`](https://github.com/github/cmark). | ||
|
||
:alien: Author | ||
------ | ||
Honza Dvorsky - https://honzadvorsky.com, [@czechboy0](http://twitter.com/czechboy0) | ||
# Installation | ||
|
||
## Swift Package Manager | ||
|
||
```swift | ||
.Package(url: "https://github.com/vapor-community/markdown.git", majorVersion: 0, minor: 1) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import XCTest | ||
@testable import cmark_swiftTests | ||
@testable import SwiftMarkdownTests | ||
|
||
XCTMain([ | ||
testCase(cmark_swiftTests.allTests), | ||
testCase(SwiftMarkdownTests.allTests), | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import XCTest | ||
import SwiftMarkdown | ||
|
||
class SwiftMarkdownTests: XCTestCase { | ||
|
||
static var allTests = [ | ||
("testMDtoHTML", testMDtoHTML), | ||
] | ||
|
||
func testMDtoHTML() { | ||
XCTAssertEqual(try markdownToHTML("# Hello"), "<h1>Hello</h1>\n") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.