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.
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" ])
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>")
As per the original repo, this wrapper is MIT licensed.