Coder Social home page Coder Social logo

parsley's Introduction

tag-changelog

A Markdown parser for Swift Package Manager, using Github Flavored Markdown. As such it comes with a bunch of Markdown extensions such as fenced code blocks, tables, strikethrough, hard line breaks and auto links.

Additionally Parsley supports embedded metadata in Markdown documents, and it splits the document title out from the document body.

let input = """
---
author: Kevin
tags: Swift, Parsley
---

# Hello World
This is the body
"""

let document = try Parsley.parse(input)
print(document.title) // Hello World
print(document.body) // <p>This is the body</p>
print(document.metadata) // ["author": "Kevin", "tags": "Swift, Parsley"]

Install

Parsley is available via Swift Package Manager and runs on macOS and Linux.

.package(url: "https://github.com/loopwerk/Parsley", from: "0.5.0"),

Use as a reader in Saga

Parsley can be used as a reader in the static site generator Saga, using SagaParsleyMarkdownReader.

Modifying the generated HTML

Parsley doesn't come with a plugin system, it relies purely on cmark-gfm under the hood to render Markdown to HTML. If you want to modify the generated HTML, for example if you want to add target="blank" to all external links, SwiftSoup is a great way to achieve this.

Adding a plugin system on top of cmark would mean that Parsley could no longer rely on the outstanding output of cmark; instead Parsley would have to parse its AST and generate HTML based on that itself, thus reinventing the (very complex) wheel.

parsley's People

Contributors

kevinrenskers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.