Perfect-Markdown 简体中文
This project provides a solution to convert markdown text into html presentations.
This package builds with Swift Package Manager and is part of the Perfect project but can also be used as an independent module.
Perfect-Markdown is directly building on GerHobbelt's "upskirt" project.
Add dependencies to your Package.swift
.package(url: "https://github.com/PerfectlySoft/Perfect-Markdown.git",
from: "3.0.0")
// on target section:
.target(
// name: "your project name",
dependencies: ["PerfectMarkdown"]),
Add the following header to your swift source code:
import PerfectMarkdown
Once imported, a new String extension markdownToHTML
would be available:
let markdown = "# some blah blah blah markdown text \n\n## with mojo 🇨🇳 🇨🇦"
guard let html = markdown.markdownToHTML else {
// conversion failed
}//end guard
print(html)
For more information on the Perfect project, please visit perfect.org.