{"id":2052,"url":"https://github.com/keitaoouchi/MarkdownView","last_synced_at":"2025-08-06T14:32:54.656Z","repository":{"id":20817638,"uuid":"90937598","full_name":"keitaoouchi/MarkdownView","owner":"keitaoouchi","description":"Markdown View for iOS.","archived":false,"fork":false,"pushed_at":"2024-03-18T13:43:59.000Z","size":4013,"stargazers_count":1991,"open_issues_count":40,"forks_count":217,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-12-06T05:03:57.057Z","etag":null,"topics":["ios","markdown","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keitaoouchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-11T04:33:42.000Z","updated_at":"2024-11-29T00:33:34.000Z","dependencies_parsed_at":"2024-06-18T14:06:33.930Z","dependency_job_id":null,"html_url":"https://github.com/keitaoouchi/MarkdownView","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.05405405405405406,"last_synced_commit":"5e62a27f1002cd63c350ef1a4c640ddcd1f1ed48"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keitaoouchi%2FMarkdownView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keitaoouchi%2FMarkdownView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keitaoouchi%2FMarkdownView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keitaoouchi%2FMarkdownView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keitaoouchi","download_url":"https://codeload.github.com/keitaoouchi/MarkdownView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228915448,"owners_count":17991406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","markdown","swift"],"created_at":"2024-01-05T20:16:02.241Z","updated_at":"2024-12-09T15:30:46.891Z","avatar_url":"https://github.com/keitaoouchi.png","language":"Swift","funding_links":[],"categories":["Libs","Text","Swift","Text [🔝](#readme)","HTML"],"sub_categories":["Text","Other free courses","Other Testing","Keychain"],"readme":"# MarkdownView\n\n[![CI Status](http://img.shields.io/travis/keitaoouchi/MArkdownView.svg?style=flat)](https://travis-ci.org/keitaoouchi/MarkdownView)\n[![Swift 5.2](https://img.shields.io/badge/Swift-5.2-orange.svg?style=flat)](https://swift.org/)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](https://img.shields.io/cocoapods/v/MarkdownView.svg?style=flat)](http://cocoapods.org/pods/MarkdownView)\n[![License](https://img.shields.io/cocoapods/l/MarkdownView.svg?style=flat)](http://cocoapods.org/pods/MarkdownView)\n[![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager)\n\n\u003e MarkdownView is a WKWebView based UI element, and internally use markdown-it, highlight-js.\n\n![GIF](https://github.com/keitaoouchi/MarkdownView/blob/master/sample.gif \"GIF\")\n\n## How to use\n\n#### UIViewController\n\n```swift\nimport MarkdownView\n\nlet md = MarkdownView()\nmd.load(markdown: \"# Hello World!\")\n```\n\n#### SwiftUI\n\n```swift\nimport SwiftUI\nimport MarkdownView\n\nstruct SampleUI: View {\n  var body: some View {\n    ScrollView {        \n      MarkdownUI(body: markdown)\n        .onTouchLink { link in \n          print(link)\n          return false\n        }\n        .onRendered { height in \n          print(height)\n        }\n    }\n  }\n  \n  private var markdown: String {\n    let path = Bundle.main.path(forResource: \"sample\", ofType: \"md\")!\n    let url = URL(fileURLWithPath: path)\n    return try! String(contentsOf: url, encoding: String.Encoding.utf8)\n  }\n}\n\n```\n\n### Options\n\n```swift\nmd.isScrollEnabled = false\n\n// called when rendering finished\nmd.onRendered = { [weak self] height in\n  self?.mdViewHeight.constant = height\n  self?.view.setNeedsLayout()\n}\n\n// called when user touch link\nmd.onTouchLink = { [weak self] request in\n  guard let url = request.url else { return false }\n\n  if url.scheme == \"file\" {\n    return false\n  } else if url.scheme == \"https\" {\n    let safari = SFSafariViewController(url: url)\n    self?.navigationController?.pushViewController(safari, animated: true)\n    return false\n  } else {\n    return false\n  }\n}\n```\n\n### Experimental Features\n\nThis is not stable :bow:\n\n#### Custom CSS Styling\n\nPlease check [Example/ViewController/CustomCss.swift](https://github.com/keitaoouchi/MarkdownView/blob/master/Example/Example/ViewController/CustomCss.swift). \n\n\u003cimg src=\"https://github.com/keitaoouchi/MarkdownView/blob/master/sample_css.png\" width=300\u003e\n\n#### Plugins\n\nPlease check [Example/ViewController/Plugins.swift](https://github.com/keitaoouchi/MarkdownView/blob/master/Example/Example/ViewController/Plugins.swift). \nEach plugin should be self-contained, with no external dependent plugins.\n\n\u003cimg src=\"https://github.com/keitaoouchi/MarkdownView/blob/master/sample_plugin.png\" width=300\u003e\n\n[Here](https://github.com/keitaoouchi/markdownview-sample-plugin) is a sample project that builds `markdown-it-new-katex` as a compatible library.\n\n## Requirements\n\n| Target            | Version |\n|-------------------|---------|\n| iOS               |  =\u003e 13.0 |\n| Swift             |  =\u003e 5.2 |\n\n## Installation\n\nMarkdownView is available through [Swift Package Manager](https://swift.org/package-manager/) or [CocoaPods](http://cocoapods.org) or [Carthage](https://github.com/Carthage/Carthage).\n\n### Swift Package Manager\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/keitaoouchi/MarkdownView.git\", from: \"1.7.1\")\n]\n```\nAlternatively, you can add the package directly via Xcode.\n\n### CocoaPods\n\n```ruby\npod \"MarkdownView\"\n```\n\n### Carthage\n\n```\ngithub \"keitaoouchi/MarkdownView\"\n```\n\nfor detail, please follow the [Carthage Instruction](https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos)\n\n\n## Author\n\nkeita.oouchi, keita.oouchi@gmail.com\n\n## License\n\n[bootstrap](http://getbootstrap.com/) is licensed under [MIT license](https://github.com/twbs/bootstrap/blob/v4-dev/LICENSE).  \n[highlight.js](https://highlightjs.org/) is licensed under [BSD-3-Clause license](https://github.com/isagalaev/highlight.js/blob/master/LICENSE).  \n[markdown-it](https://markdown-it.github.io/) is licensed under [MIT license](https://github.com/markdown-it/markdown-it/blob/master/LICENSE).  \n\nMarkdownView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeitaoouchi%2FMarkdownView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeitaoouchi%2FMarkdownView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeitaoouchi%2FMarkdownView/lists"}