Swiftpack.co - Package - ntrupin/swiftmark


swiftmark is a simple, lightweight way to convert Markdown to HTML in Swift. With no dependencies (other than Foundation) and an intuitive library, swiftmark fits in to any project without a hassle.



  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 8.0+


swiftmark can be installed through the Swift Package Manager.

Swift Package Manager

Swift Package Manager requires Swift version 4.0 or higher. Then,

  1. Create a Package.swift file. It should look like:
dependencies: [
    .package(url: "https://github.com/ntrupin/swiftmark.git", from: "1.0.0")
  1. Run swift build to fetch and compile swiftmark so you may use it.

In Xcode 11+, there is a Swift Packages tab in the project window. You can add swiftmark authomatically through there by clicking the "+" button and adding "https://github.com/ntrupin/swiftmark.git" as a required Swift package.


Gettings started with swiftmark is as simple as adding import swiftmark to the top of the file you wish to use it in.

Once the library has been imported, you may call the conversion function from within your code. The class accepts a string, which is your Markdown, and returns a string, which is the HTML created from your Markdown.

import swiftmark

// MARK: Classic
let md = swiftmark("# Hello, world!")
let html = md.html()
print(html) // prints <h1>Hello, world!</h1>


Below are some examples of using swiftmark.


let md = swiftmark("# Hello, world!")

You may also initialize swiftmark with multi-line strings.

let md = swiftmark("""
# Hello, world!

This is a multi-line string.

Convert to HTML

When given:

# Hello, world!

We are using [swiftmark](https://github.com/ntrupin/swiftmark/)!

swiftmark will return:

<h1>Hello, world!</h1>

We are using <a href="https://github.com/ntrupin/swiftmark/">swiftmark</a>!


Stars: 0
Help us keep the lights on


Used By

Total: 1