Swiftpack.co - Package - unsignedapps/swift-tree-sitter-markdown
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Tree Sitter Markdown

Markdown (CommonMark Spec v0.29-gfm) grammar for tree-sitter

This is a Swift wrapper of the grammar at https://github.com/ikatyang/tree-sitter-markdown and is designed to be used with swift-tree-sitter.

Installation

To include swift-tree-sitter-markdown in your Swift package add the following dependency to your Package.swift:

.package(url: "https://github.com/unsignedapps/swift-tree-sitter-markdown.git", from: "1.0")

This will include swift-tree-sitter as a dependency.

Don't forget to include the library in your target:

.target(name: "BestExampleApp", dependencies: [ "TreeSitter", "TreeSitterMarkdown" ])

Usage

You can find the markdown grammars in Language.markdown:

import Foundation
import TreeSitter
import TreeSitterMarkdown

let parser = Parser()						// Create a new TreeSitter Parser
try parser.setLanguage(.markdown)			// Set the language to Markdown
let tree = try parser.parseSync("<markdown here>")

License

As per the original repo, this wrapper is MIT licensed.

Github

link
Stars: 0

Releases

Release 0.1.3: Bug Fixes - 2021-01-13T05:48:29

This release fixes the incomplete update process to tree-sitter 0.18.0 that was introduced in 0.1.2

Release 0.1.2 - 2021-01-13T05:18:39

Updates upstream Tree Sitter to 0.18.0

Initial release - 2021-01-05T10:44:05