Skip to content

Commit

Permalink
chore: update versions & docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Sep 10, 2024
1 parent a3481e1 commit c25b635
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 51 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
uses: tree-sitter/parser-test-action@v2
with:
test-rust: true
test-parser-cmd: npm test
- name: Rebuild with default extensions
run: npm run build
- name: Verify grammar consistency
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "tree-sitter-md"
description = "Markdown grammar for tree-sitter"
version = "0.3.0"
version = "0.3.1"
license = "MIT"
readme = "README.md"
keywords = ["incremental", "parsing", "tree-sitter", "markdown"]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
[![npm][npm]](https://www.npmjs.com/package/@tree-sitter-grammars/tree-sitter-markdown)
[![crates][crates]](https://crates.io/crates/tree-sitter-md)
[![pypi][pypi]](https://pypi.org/project/tree-sitter-markdown/)

A Markdown parser for [tree-sitter].

Expand Down Expand Up @@ -78,3 +79,4 @@ Unfortunately using this parser with WASM/web-tree-sitter does not work out of t
[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix
[npm]: https://img.shields.io/npm/v/%40tree-sitter-grammars%2Ftree-sitter-markdown?logo=npm
[crates]: https://img.shields.io/crates/v/tree-sitter-md?logo=rust
[pypi]: https://img.shields.io/pypi/v/tree-sitter-markdown?logo=pypi&logoColor=ffd242
27 changes: 20 additions & 7 deletions bindings/rust/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! This crate provides Markdown language support for the [tree-sitter][] parsing library.
//!
//! It contains two grammars: [`language`] to parse the block structure of markdown documents and
//! [`inline_language`] to parse inline content.
//! It contains two grammars: [`LANGUAGE`] to parse the block structure of markdown documents and
//! [`INLINE_LANGUAGE`] to parse inline content.
//!
//! It also supplies [`MarkdownParser`] as a convenience wrapper around the two grammars.
//! [`MarkdownParser::parse`] returns a [`MarkdownTree`] instread of a [`Tree`][Tree]. This struct
Expand All @@ -26,12 +26,19 @@ pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_markd
pub const INLINE_LANGUAGE: LanguageFn =
unsafe { LanguageFn::from_raw(tree_sitter_markdown_inline) };

/// The syntax highlighting queries for the block grammar.
pub const HIGHLIGHT_QUERY_BLOCK: &str =
include_str!("../../tree-sitter-markdown/queries/highlights.scm");

/// The language injection queries for the block grammar.
pub const INJECTION_QUERY_BLOCK: &str =
include_str!("../../tree-sitter-markdown/queries/injections.scm");

/// The syntax highlighting queries for the inline grammar.
pub const HIGHLIGHT_QUERY_INLINE: &str =
include_str!("../../tree-sitter-markdown-inline/queries/highlights.scm");

/// The language injection queries for the inline grammar.
pub const INJECTION_QUERY_INLINE: &str =
include_str!("../../tree-sitter-markdown-inline/queries/injections.scm");

Expand All @@ -47,24 +54,30 @@ pub const NODE_TYPES_INLINE: &str =
include_str!("../../tree-sitter-markdown-inline/src/node-types.json");

#[cfg(feature = "parser")]
#[cfg_attr(docsrs, doc(cfg(feature = "parser")))]
mod parser;

#[cfg(feature = "parser")]
#[cfg_attr(docsrs, doc(cfg(feature = "parser")))]
pub use parser::*;

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn can_load_grammar() {
fn can_load_block_grammar() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(&LANGUAGE.into())
.expect("Error loading Markdown language");
let mut inline_parser = tree_sitter::Parser::new();
inline_parser
.expect("Error loading Markdown block grammar");
}

#[test]
fn can_load_inline_grammar() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(&INLINE_LANGUAGE.into())
.expect("Error loading Markdown language");
.expect("Error loading Markdown inline grammar");
}
}
5 changes: 3 additions & 2 deletions bindings/rust/parser.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/common.mak

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 15 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tree-sitter-grammars/tree-sitter-markdown",
"version": "0.3.0",
"version": "0.3.1",
"description": "Markdown grammar for tree-sitter",
"repository": "github:tree-sitter-grammars/tree-sitter-markdown",
"author": "MDeiml (https://github.com/MDeiml)",
Expand All @@ -24,11 +24,11 @@
"common/html_entities.json"
],
"dependencies": {
"node-addon-api": "^8.0.0",
"node-gyp-build": "^4.8.0"
"node-addon-api": "^8.1.0",
"node-gyp-build": "^4.8.1"
},
"devDependencies": {
"prebuildify": "^6.0.0",
"prebuildify": "^6.0.1",
"tree-sitter-cli": "^0.23.0"
},
"peerDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "tree-sitter-markdown"
description = "Markdown grammar for tree-sitter"
version = "0.3.0"
version = "0.3.1"
keywords = ["incremental", "parsing", "tree-sitter", "markdown"]
classifiers = [
"Intended Audience :: Developers",
Expand All @@ -17,7 +17,7 @@ classifiers = [
authors = [
{name = "MDeiml"}
]
requires-python = ">=3.8"
requires-python = ">=3.9"
license.text = "MIT"
readme = "README.md"

Expand All @@ -28,5 +28,5 @@ Homepage = "https://github.com/tree-sitter-grammars/tree-sitter-markdown"
core = ["tree-sitter~=0.23"]

[tool.cibuildwheel]
build = "cp38-*"
build = "cp39-*"
build-frontend = "build"
4 changes: 2 additions & 2 deletions setup.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c25b635

Please sign in to comment.