Popularity
2.4
Stable
Activity
0.0
Stable
80
9
12

Code Quality Rank: L5
Programming language: Swift
License: GNU General Public License v3.0 only
Tags: Text    
Latest version: v1.0.0-alpha.2

Markdown alternatives and similar libraries

Based on the "Text" category.
Alternatively, view Markdown alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Markdown or a related project?

Add another 'Text' Library

README

Markdown

🐧 linux: ready Build Status Carthage compatible Platform OS X | Linux Swift version GitHub license GitHub release

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

Goals

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:"% test\n% daniel\n% 02.03.2016\n")

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


*Note that all licence references and agreements mentioned in the Markdown README section above are relevant to that project's source code only.