Skip to content
This repository was archived by the owner on Mar 25, 2020. It is now read-only.

finnvoor/InkView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

121 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Under Construction ⚠️

InkView

This is a fork of John Sundell's Markdown parser Ink. Ink was designed to render Markdown to HTML, whereas this project aims to render Markdown as a SwiftUI view. Ink parses markdown into fragments which are then converted to HTML. This fork assigns each of these fragments a View representation.

Usage

import SwiftUI
import InkView

struct ExampleView: View {
    let parser = MarkdownParser()
    let markdown =
    """
    # Hello
    ---
    This is a **markdown** document.
    > Pretty cool
    """
    
    var body: some View {
        parser.view(from: self.markdown)
    }
}

InkView

Installation

InkView is distributed using the Swift Package Manager. To install it into a project, simply add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/Finnvoor/InkView.git", .branch("master"))
    ],
    ...
)

Then import InkView wherever you’d like to use it:

import InkView

For more information on how to use the Swift Package Manager, check out this article, or its official documentation.

Supported syntax

InkView currently supports the following Markdown features:

  • Headings (H1 - H6), using leading pound signs, for example ## H2.
  • Italic text, by surrounding a piece of text with either an asterisk (*), or an underscore (_). For example Italic text.
  • Bold text, by surrounding a piece of text with either two asterisks (**), or two underscores (__). For example Bold text.
  • Text strikethrough, by surrounding a piece of text with two tildes (~~), for example Strikethrough text.
  • Inline code, marked with a backtick on either site of the code.
  • Code blocks, marked with three or more backticks both above and below the block.
  • Links, using the following syntax: [Title](url).
  • Horizontal lines can be placed using either three asterisks (***) or three dashes (---) on a new line.
  • Blockquotes can be created by placing a greater-than arrow at the start of a line, like this: > This is a blockquote.

About

SwiftUI Markdown rendering using Ink

Topics

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE_Ink

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Swift 100.0%