Swiftpack.co -  Package - unsignedapps/swift-tree-sitter-markdown
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
unsignedapps/swift-tree-sitter-markdown
A Swift wrapper around tree-sitter-markdown
.package(url: "https://github.com/unsignedapps/swift-tree-sitter-markdown.git", from: "0.1.5")

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
Last commit: 4 weeks ago

Release Notes

Release 0.1.5
4 weeks ago

Fixes an incorrectly referenced markdown node symbol name.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco