Swiftpack.co - Package - loopwerk/SwiftMarkdown2

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

loopwerk/SwiftMarkdown2

A Swift wrapper for python-markdown2

SwiftMarkdown2

A Swift wrapper for python-markdown2, using PythonKit.

You'll need to install python-markdown2 (and optionally pygments) yourself.

Usage

import SwiftMarkdown2

let markdown = try SwiftMarkdown2.markdown("Hello, World!", extras: [.fencedCodeBlocks])
print(markdown.html)

let string = """
---
tags: news, swift
date: 2021-02-04
---
# Hello world
This uses metadata
"""

let markdownWithMetadata = try SwiftMarkdown2.markdown(string, extras: [.metadata])
print(markdownWithMetadata.metadata) // ["tags": "news, swift", "date": "2021-02-04"]

See https://github.com/trentm/python-markdown2/wiki/Extras for documentation on the "extras".

Installation

Using Swift Package Manager

.package(url: "https://github.com/loopwerk/SwiftMarkdown2", from: "0.2.0"),

Github

link
Stars: 1
Last commit: 6 days ago

Dependencies