Markdown View for iOS.
Clone or download
keitaoouchi Support Swift4.2 (#33)
* Support Swift4.2

* Bump version

* update .travis.yml

* fix osx_image
Latest commit fa98036 Oct 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example Support Swift4.2 (#33) Oct 18, 2018
MarkdownView.xcodeproj Support Swift4.2 (#33) Oct 18, 2018
MarkdownView Support Swift4.2 (#33) Oct 18, 2018
webassets Fix Bundle path for resource (#25) Jun 9, 2018
.gitignore init May 11, 2017
.swift-version Add support for swift4, xcode9 (#10) Oct 24, 2017
.travis.yml Support Swift4.2 (#33) Oct 18, 2018
LICENSE init May 11, 2017
MarkdownView.podspec Support Swift4.2 (#33) Oct 18, 2018
README.md Support Swift4.2 (#33) Oct 18, 2018
sample.gif v1.0.0 (#2) May 16, 2017
sample.md Add example project (#1) May 16, 2017

README.md

MarkdownView

CI Status Swift 4.2 Carthage compatible Version License

MarkdownView is a WKWebView based UI element, and internally use bootstrap, highlight.js, markdown-it.

GIF

How to use

import MarkdownView

let md = MarkdownView()
md.load(markdown: "# Hello World!")

Options

md.isScrollEnabled = false

// called when rendering finished
md.onRendered = { [weak self] height in
  self?.mdViewHeight.constant = height
  self?.view.setNeedsLayout()
}

// called when user touch link
md.onTouchLink = { [weak self] request in
  guard let url = request.url else { return false }

  if url.scheme == "file" {
    return false
  } else if url.scheme == "https" {
    let safari = SFSafariViewController(url: url)
    self?.navigationController?.pushViewController(safari, animated: true)
    return false
  } else {
    return false
  }
}

Requirements

Target Version
iOS => 9.0
Swift => 4.2

Installation

MarkdownView is available through CocoaPods or Carthage.

CocoaPods

pod "MarkdownView"

Carthage

github "keitaoouchi/MarkdownView"

for detail, please follow the Carthage Instruction

Author

keita.oouchi, keita.oouchi@gmail.com

License

bootstrap is licensed under MIT license.
highlight.js is licensed under BSD-3-Clause license.
markdown-it is licensed under MIT license.

MarkdownView is available under the MIT license. See the LICENSE file for more info.