All Projects → dasautoooo → Parma

dasautoooo / Parma

Licence: mit
A SwiftUI view for displaying Markdown with customizable appearances.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Parma

Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (-10.35%)
Mutual labels:  markdown
Imgui markdown
Markdown for Dear ImGui
Stars: ✭ 594 (-5.41%)
Mutual labels:  markdown
Daux.io
Daux.io is an documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way.
Stars: ✭ 603 (-3.98%)
Mutual labels:  markdown
Vscode Markdown Pdf
Markdown converter for Visual Studio Code
Stars: ✭ 571 (-9.08%)
Mutual labels:  markdown
Hugo Theme Hello Friend
Pretty basic theme for Hugo that covers all of the essentials. All you have to do is start typing!
Stars: ✭ 586 (-6.69%)
Mutual labels:  markdown
Homebrewery
Create authentic looking D&D homebrews using only markdown
Stars: ✭ 598 (-4.78%)
Mutual labels:  markdown
React Markdown Editor Lite
a light-weight Markdown editor based on React. 一款轻量的基于React的markdown编辑器
Stars: ✭ 553 (-11.94%)
Mutual labels:  markdown
Dprint
Pluggable and configurable code formatting platform written in Rust.
Stars: ✭ 610 (-2.87%)
Mutual labels:  markdown
Ox Hugo
A carefully crafted Org exporter back-end for Hugo
Stars: ✭ 591 (-5.89%)
Mutual labels:  markdown
Pragmatic Programmer Zh
《Pragmatic Programmer》中文翻译
Stars: ✭ 603 (-3.98%)
Mutual labels:  markdown
Bluedoc
An open-source document management tool for enterprise self host.
Stars: ✭ 579 (-7.8%)
Mutual labels:  markdown
Kodexplorer
A web based file manager,web IDE / browser based code editor
Stars: ✭ 5,490 (+774.2%)
Mutual labels:  markdown
Code Surfer
Rad code slides <🏄/>
Stars: ✭ 5,477 (+772.13%)
Mutual labels:  markdown
Remarkable
Markdown parser, done right. Commonmark support, extensions, syntax plugins, high speed - all in one. Gulp and metalsmith plugins available. Used by Facebook, Docusaurus and many others! Use https://github.com/breakdance/breakdance for HTML-to-markdown conversion. Use https://github.com/jonschlinkert/markdown-toc to generate a table of contents.
Stars: ✭ 5,252 (+736.31%)
Mutual labels:  markdown
Idea Markdown
Markdown language support for IntelliJ IDEA (abandonned).
Stars: ✭ 604 (-3.82%)
Mutual labels:  markdown
Csvtomd
📝📊 Convert your CSV files into Markdown tables.
Stars: ✭ 555 (-11.62%)
Mutual labels:  markdown
Docbase
Turn .md docs into beautiful sites
Stars: ✭ 595 (-5.25%)
Mutual labels:  markdown
Wp Editor.md
或许这是一个WordPress中最好,最完美的Markdown编辑器
Stars: ✭ 624 (-0.64%)
Mutual labels:  markdown
Marp Cli
A CLI interface for Marp and Marpit based converters
Stars: ✭ 606 (-3.5%)
Mutual labels:  markdown
Gitpitch
Markdown Presentations for Tech Conferences, Training, Developer Advocates, and Educators.
Stars: ✭ 5,333 (+749.2%)
Mutual labels:  markdown

Parma

Display Markdown using pure SwiftUI components. Taking advantages of ViewBuilder to make custom appearances for Text and View.

Example

import Parma

struct ContentView: View {
    var markdown = "I'm **Strong**."
    
    var body: some View {
        Parma(markdown)
    }
}

For more examples, please refer to demo app.

Markdown Support

Already Supported

  • Heading level 1-6
  • Paragraph
  • Multi-level bullet list
  • Image (Needs extra configurations)
  • Inline text
    • Strong
    • Emphasis
    • Code

Possibly Support in Future Versions

  • Divider
  • Multi-level ordered list
  • Block quote
  • Code block

Unsupported

  • Inline hyperlink

Installation

Requirement

  • Xcode 11.0 or later
  • Swift 5 or later
  • iOS 13.0 / macOS 10.15 or later deployment targets

Swift Package Manager

Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies on all platforms.

Adding Parma as a dependency by using Xcode’s GUI, the package url is https://github.com/dasautoooo/Parma .

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Parma into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Parma'

Appearance Customization

To customize Text styles and Views, create a new render which conform to protocol ParmaRenderable, and only reimplement those that fit your purposes. Finally, assign the customized render as a new render when create Parma view.

import Parma

struct ContentView: View {
    var markdown = "I'm **Strong**."
    
    var body: some View {
        Parma(markdown, render: MyRender())
    }
}

struct MyRender: ParmaRenderable {
    ...
}

There's a DemoApp that modified some of these delegate methods below for everyone to take as a reference.

/// Define the heading text style.
/// - Parameters:
///   - level: The level of heading.
///   - textView: The textView generated from captured heading string.
func heading(level: HeadingLevel?, textView: Text) -> Text

/// Define the paragraph text style.
/// - Parameter text: The text string captured from paragraph.
func paragraph(text: String) -> Text

/// Define the text style for plain text. Do NOT recommend to alter this if there's no special purpose.
/// - Parameter text: The text string captured from markdown.
func plainText(_ text: String) -> Text

/// Define the strong text style.
/// - Parameter textView: The textView generated from captured strong string.
func strong(textView: Text) -> Text

/// Define the emphasis text style.
/// - Parameter textView: The textView generated from captured emphasis string.
func emphasis(textView: Text) -> Text

/// Define the link text style.
/// - Parameters:
///   - textView: The textView generated from captured link string.
///   - destination: The destination of the link.
func link(textView: Text, destination: String?) -> Text

/// Define the code text style.
/// - Parameter text: The text string captured from code.
func code(_ text: String) -> Text

/// Define the style of heading view.
/// - Parameters:
///   - level: The level of heading.
///   - view: The view contains heading text.
func headingBlock(level: HeadingLevel?, view: AnyView) -> AnyView

/// Define the style of paragraph view.
/// - Parameter view: The view contains view(s) which belong(s) to this paragraph.
func paragraphBlock(view: AnyView) -> AnyView

/// Define the style of list item.
/// - Parameter view: The view contains view(s) which belong(s) to this item.
func listItem(view: AnyView) -> AnyView

/// Define the style of image view.
/// - Parameter urlString: The url string for this image view.
/// - Parameter altTextView: The view contains alt text.
func imageView(with urlString: String, altTextView: AnyView?) -> AnyView

Name Origin

Parma is a city in the northern Italy, which is famous for its architecture, music and art. The reason of choosing this city name as the project name is Giambattista Bodoni, a famous typographer, who spent most his lifetime living and working in this city.

Bodoni was an Italian typographer, type-designer in Parma. During his lifespan, he designed many typefaces that known as Bodoni nowadays. Each Mac has Bodoni font installed, and free to use.

Credit

The package is built upon Down, which is a markdown parser in Swift.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].