MarkdownView:Markdown 文档预览视图组件

来源:互联网 发布:内涵吧源码 编辑:程序博客网 时间:2024/06/15 16:23
原文链接:https://github.com/keitaoouchi/MarkdownView
MarkdownView:Markdown 文档预览视图组件。# 为开源点赞# —— 由SwiftLanguage分享

Swift 3.0 Version License

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

GIF

How to use

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

Options

md.isScrollEnabled = false// called when rendering finishedmd.onRendered = { [weak self] height in  self?.mdViewHeight.constant = height  self?.view.setNeedsLayout()}// called when user touch linkmd.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.

CocoaPods

pod "MarkdownView"

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.


原创粉丝点击