Jekyll build failure #123
-
Hi. Thanks for this great plugin. I'm trying to figure this out with my blog, but I failed to compile my jekyll blog.
It seems like every language shows the same error. I'm using Here is my Gemfile:
, and my plugins:
- jekyll-feed
- jekyll-seo-tag
- jekyll-org
- kramdown/syntax_tree_sitter
markdown: kramdown
highlighter: rouge
kramdown:
input: GFM
syntax_highlighter: tree-sitter
syntax_highlighter_opts:
css_class: 'highlight'
span:
line_numbers: false
block:
line_numbers: false How do I fix this error? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hi! Happy to help. I believe this is the root issue:
I think you still need to add some Tree Sitter language parsers to your project so that this tool can find and use them. Unlike many syntax highlighters with built-in support for many popular languages, Tree Sitter relies on external language parser libraries to understand the grammar of each language. For example, tree-sitter/tree-sitter-cpp is the project for the Tree Sitter C++ parser library. More information on how that applies to this tool can be found here in the README, but feel free to let me know if you're still confused. Also, I happen to know that it is especially complicated to set up the C++ parser library in particular, because that Tree Sitter grammar has a dependency on the Tree Sitter C grammar. It is possible to get it to work but I might suggest trying to get things working with basically any other language first. |
Beta Was this translation helpful? Give feedback.
-
Wow, thank you for the gentle explanation!! As you said, I missed the README part.
I also tried to install |
Beta Was this translation helpful? Give feedback.
-
I think you're now encountering the issue that makes the Tree Sitter C++ parser particularly complicated to use; namely, that it has a dependency on the Tree Sitter C parser, and that this dependency is not resolved by default. One successful workaround I have personally used is to symbolically link the Tree Sitter C++ ln -s .. ~/tree_sitter_parsers/tree-sitter-cpp/node_modules This is what I do for my own Jekyll-based site, as described here. Hopefully that will work for you too! |
Beta Was this translation helpful? Give feedback.
-
Thank you! kramdown:
syntax_highlighter: tree-sitter
syntax_highlighter_opts:
tree_sitter_parsers_dir: tree_sitter_parsers I cloned every language I've written into this directory in my project. I then ran Now I got the following message:
What am I missing? 😢 |
Beta Was this translation helpful? Give feedback.
-
Hmm that doesn't look so good. I'm not exactly sure how your site is structured, but if my hunch is correct then think I encountered a similar issue in the past and solved it like this. Namely, I added the Tree Sitter parsers directory to my Jekyll exclude list so that Jekyll wouldn't traverse it while building my site. Maybe something similar will work for you? |
Beta Was this translation helpful? Give feedback.
-
Wow, thank you very much!! |
Beta Was this translation helpful? Give feedback.
Hi! Happy to help.
I believe this is the root issue:
I think you still need to add some Tree Sitter language parsers to your project so that this tool can find and use them. Unlike many syntax highlighters with built-in support for many popular languages, Tree Sitter relies on external language parser libraries to understand the grammar of each language. For example, tree-sitter/tree-sitter-cpp is the project for the Tree Sitter C++ parser library. More information on how that applies to this tool can be found here in the README, but feel free to let me know if you're still confused.
Also, I happen to kno…