Latest 1.0.0-alpha.2
Homepage https://github.com/crossroadlabs/Markdown
License LGPL
Platforms ios 8.0, osx 10.10, tvos 9.0, watchos 2.0, requires ARC
Dependencies CDiscount
Frameworks Foundation
Authors

Markdown

🐧 linux: ready
Build Status
Carthage compatible
Platform OS X | Linux
![Swift version](https://img.shields.io/badge/Swift-2.1 | 2.2-blue.svg)
![GitHub license](https://img.shields.io/badge/license-LGPL v3-green.svg)
GitHub release

Full markdown support for Swift – wrapper over Discount (this actually is what GitHub uses deep down)

Goals

Markdown Markdown library was mainly introduced to fulfill the needs of Swift Express – web application server side framework for Swift.

Still we hope it will be useful for everybody else.

Happy marking down ;)

Getting started

Installation

Prerequisites

First of all you need to install Discount.

OS X:
#this one install a static library, so don't worry about redistribution
brew install discount
Linux:
sudo apt-get install libmarkdown2-dev

Package Manager

Add the following dependency to your Package.swift:

.Package(url: "https://github.com/crossroadlabs/Markdown.git", majorVersion: 0)

Run swift build and build your app. Package manager is supported on OS X, but it’s still recommended to be used on Linux only.

Carthage

Add the following to your Cartfile:

github "crossroadlabs/Markdown"

Run carthage update and follow the steps as described in Carthage’s README.

Examples

Hello Markdown

let md = try Markdown(string:"# Hello Markdown")
let document = try md.document()
print(document)

The output will be the following:

<h1>Hello Markdown</h1>

Metadata

let md = try Markdown(string:"% testn% danieln% 02.03.2016n")

let title = md.title!
let author = md.author!
let date = md.date

print("Title: ", title)
print("Author: ", author)
print("Date: ", date)

The output will be the following:

Title: test
Author: daniel
Date: 02.03.2016

Table of contents

let md = try Markdown(string:"# test header", options: .TableOfContents)
let toc = try md.tableOfContents()
print(toc)

The output will be the following:

<ul>
 <li><a href="#test.header">test header</a></li>
</ul>

Style

let md = try Markdown(string:"<style>background-color: yellow;</style>n# test header")
let css = try md.css()
print(css)

The output will be the following:

<style>background-color: yellow;</style>

Have a nice marking down ;)

Contributing

To get started, sign the Contributor License Agreement.

Crossroad Labs by Crossroad Labs

Latest podspec

{
    "name": "Markdown",
    "version": "1.0.0-alpha.2",
    "summary": "Full markdown support for Swift - wrapper over Discount (this actually is what GitHub uses deep down)",
    "homepage": "https://github.com/crossroadlabs/Markdown",
    "license": {
        "type": "LGPL",
        "file": "LICENSE.LESSER.txt"
    },
    "authors": {
        "Daniel Leping": "[email protected]"
    },
    "source": {
        "git": "https://github.com/crossroadlabs/Markdown.git",
        "tag": "1.0.0-alpha.2"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "source_files": "Sources/Markdown/*.swift",
    "frameworks": "Foundation",
    "requires_arc": true,
    "dependencies": {
        "CDiscount": [
            "~> 2.2"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This