Latest 1.0.3
Homepage https://github.com/keitaoouchi/MarkdownView
License MIT
Platforms ios 9.0
Frameworks Foundation
Authors

Swift 3.0
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

iOS 9 or later.
Swift3.0 or later.

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, [email protected]

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.

Latest podspec

{
    "name": "MarkdownView",
    "version": "1.0.3",
    "summary": "Markdown View for iOS.",
    "homepage": "https://github.com/keitaoouchi/MarkdownView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "keitaoouchi": "[email protected]"
    },
    "source": {
        "git": "https://github.com/keitaoouchi/MarkdownView.git",
        "tag": "1.0.3"
    },
    "source_files": "MarkdownView/*.swift",
    "resource_bundles": {
        "MarkdownView": [
            "webassets/dist/*"
        ]
    },
    "frameworks": "Foundation",
    "platforms": {
        "ios": "9.0"
    },
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This