All Projects → hebertialmeida → MarkdownSyntax

hebertialmeida / MarkdownSyntax

Licence: other
☄️ A Type-safe Markdown parser in Swift.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to MarkdownSyntax

xast
Extensible Abstract Syntax Tree
Stars: ✭ 32 (-50.77%)
Mutual labels:  ast, syntax-tree, unist
mdast-util-to-string
utility to get the plain text content of an mdast node
Stars: ✭ 27 (-58.46%)
Mutual labels:  syntax-tree, unist, mdast
Unified
☔️ interface for parsing, inspecting, transforming, and serializing content through syntax trees
Stars: ✭ 3,036 (+4570.77%)
Mutual labels:  ast, syntax-tree, unist
mdast-util-to-hast
utility to transform mdast to hast
Stars: ✭ 53 (-18.46%)
Mutual labels:  syntax-tree, unist, mdast
sast
Parse CSS, Sass, SCSS, and Less into a unist syntax tree
Stars: ✭ 51 (-21.54%)
Mutual labels:  ast, syntax-tree, unist
nlcst-to-string
utility to transform an nlcst tree to a string
Stars: ✭ 16 (-75.38%)
Mutual labels:  syntax-tree, unist
Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+6010.77%)
Mutual labels:  ast, syntax-tree
Mdast
Markdown Abstract Syntax Tree format
Stars: ✭ 493 (+658.46%)
Mutual labels:  ast, syntax-tree
Libdparse
Library for lexing and parsing D source code
Stars: ✭ 91 (+40%)
Mutual labels:  ast, syntax-tree
bright
Blazing fast parser for BrightScript that gives you ESTree like AST
Stars: ✭ 28 (-56.92%)
Mutual labels:  ast, syntax-tree
Metric Parser
📜 AST-based advanced mathematical parser written by Typescript.
Stars: ✭ 26 (-60%)
Mutual labels:  ast, syntax-tree
Astviewer
Python Abstract Syntax Tree viewer in Qt
Stars: ✭ 101 (+55.38%)
Mutual labels:  ast, syntax-tree
hast-util-to-mdast
utility to transform hast (HTML) to mdast (markdown)
Stars: ✭ 26 (-60%)
Mutual labels:  unist, mdast
Hast
Hypertext Abstract Syntax Tree format
Stars: ✭ 344 (+429.23%)
Mutual labels:  ast, syntax-tree
Unist
Universal Syntax Tree used by @unifiedjs
Stars: ✭ 438 (+573.85%)
Mutual labels:  ast, syntax-tree
Reshape
💠 transform html with javascript plugins
Stars: ✭ 314 (+383.08%)
Mutual labels:  ast, syntax-tree
Astexplorer.app
https://astexplorer.net with ES Modules support and Hot Reloading
Stars: ✭ 65 (+0%)
Mutual labels:  ast, syntax-tree
Down
Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Stars: ✭ 1,895 (+2815.38%)
Mutual labels:  ast, cmark
Escaya
An blazing fast 100% spec compliant, incremental javascript parser written in Typescript
Stars: ✭ 217 (+233.85%)
Mutual labels:  ast, syntax-tree
jsdast
JSDoc Abstract Syntax Tree
Stars: ✭ 20 (-69.23%)
Mutual labels:  ast, unist

☄️ MarkdownSyntax

codecov

MarkdownSyntax is a wrapper on top of the Github Flavoured Markdown that conforms to mdast. It parses markdown and creates a normalized AST so you can use it not only for rendering markdown and syntax highlighting. In addition, you can render to standard cmark formats HTML, XML, Man, Latex, Plain Text.

Usage

let input = "Hi this is **alpha**"
let tree = try Markdown(text: input).parse()

Outputs a normalized tree:

Root(
    children: [
        Paragraph(
            children: [
                Text(
                    value: "Hi this is ", 
                    position: Position(
                        start: Point(line: 1, column: 1, offset: 0), 
                        end: Point(line: 1, column: 11, offset: 10), 
                        indent: nil
                    )
                ), 
                Strong(
                    children: [
                        Text(
                            value: "alpha", 
                            position: Position(
                                start: Point(line: 1, column: 14, offset: 13), 
                                end: Point(line: 1, column: 18, offset: 17), 
                                indent: nil
                            )
                        )
                    ], 
                    position: Position(
                        start: Point(line: 1, column: 12, offset: 11), 
                        end: MarkdownSyntax.Point(line: 1, column: 20, offset: 19), 
                        indent: nil
                    )
                )
            ], 
            position: Position(
                start: Point(line: 1, column: 1, offset: 0), 
                end: Point(line: 1, column: 20, offset: 19), 
                indent: nil
            )
        )
    ], 
    position: Position(
        start: Point(line: 1, column: 1, offset: 0), 
        end: Point(line: 1, column: 20, offset: 19), 
        indent: nil
    )
)

For more examples checkout the tests MarkdownSyntaxTests.

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding MarkdownSyntax as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/hebertialmeida/MarkdownSyntax", from: "1.1.0")
]

Acknowledgements

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].