-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use MDeiml/tree-sitter-markdown as markdown grammar instead
- Loading branch information
Showing
42 changed files
with
129,341 additions
and
59,230 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package markdown_inline | ||
|
||
//#include "parser.h" | ||
//TSLanguage *tree_sitter_markdown_inline(); | ||
import "C" | ||
import ( | ||
"unsafe" | ||
|
||
sitter "github.com/smacker/go-tree-sitter" | ||
) | ||
|
||
func GetLanguage() *sitter.Language { | ||
ptr := unsafe.Pointer(C.tree_sitter_markdown_inline()) | ||
return sitter.NewLanguage(ptr) | ||
} |
8 changes: 4 additions & 4 deletions
8
markdown/binding_test.go → ...ee-sitter-markdown-inline/binding_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package markdown_test | ||
package markdown_inline_test | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
sitter "github.com/smacker/go-tree-sitter" | ||
"github.com/smacker/go-tree-sitter/markdown" | ||
"github.com/smacker/go-tree-sitter/markdown/tree-sitter-markdown-inline" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGrammar(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
n, err := sitter.ParseCtx(context.Background(), []byte("# This is a header"), markdown.GetLanguage()) | ||
n, err := sitter.ParseCtx(context.Background(), []byte("# This is a heading"), markdown_inline.GetLanguage()) | ||
assert.NoError(err) | ||
assert.Equal( | ||
"(document (atx_heading (atx_h1_marker) (heading_content (text))))", | ||
"(inline)", | ||
n.String(), | ||
) | ||
} |
Oops, something went wrong.