{"id":19638972,"url":"https://github.com/savetheclocktower/tree-sitter-frontmatter","last_synced_at":"2026-05-26T16:37:14.333Z","repository":{"id":206719077,"uuid":"666179146","full_name":"savetheclocktower/tree-sitter-frontmatter","owner":"savetheclocktower","description":"A parser for front matter blocks (typically found in Markdown files)","archived":false,"fork":false,"pushed_at":"2023-11-11T19:55:06.000Z","size":14,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-21T16:03:08.917Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/savetheclocktower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-13T22:45:52.000Z","updated_at":"2024-10-20T04:47:35.000Z","dependencies_parsed_at":"2023-11-11T20:43:15.754Z","dependency_job_id":null,"html_url":"https://github.com/savetheclocktower/tree-sitter-frontmatter","commit_stats":null,"previous_names":["savetheclocktower/tree-sitter-frontmatter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/savetheclocktower/tree-sitter-frontmatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-frontmatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-frontmatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-frontmatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-frontmatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/savetheclocktower","download_url":"https://codeload.github.com/savetheclocktower/tree-sitter-frontmatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/savetheclocktower%2Ftree-sitter-frontmatter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33530320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T12:43:24.125Z","updated_at":"2026-05-26T16:37:14.316Z","avatar_url":"https://github.com/savetheclocktower.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tree-sitter-frontmatter\n\n[Tree-sitter][] parser for [front matter](https://jekyllrb.com/docs/front-matter/) in arbitrary files.\n\nDoes not try to understand the contents of the file beyond the front matter delimiters. The proper parsers for the front-matter contents and the remainder of the file can be injected as needed.\n\n## Why does this exist?\n\n[Pulsar][] uses [ikatyang/tree-sitter-markdown](https://github.com/ikatyang/tree-sitter-markdown) for Markdown files; it’s very robust, but lacks support for the [YAML front matter](https://jekyllrb.com/docs/front-matter/) convention popularized by Jekyll.\n\nInstead of trying to add such support to a complex and intimidating Tree-sitter parser, I chose to write my own Tree-sitter parser instead, one whose only purpose is to separate a front matter block from other content in a file.\n\nPulsar uses this parser to divide a file into two parts. It then injects YAML syntax highlighting into the front matter (if present) and Markdown syntax highlighting into the remainder of the file.\n\n## How does parsing work?\n\nIn lieu of a proper front-matter specification, I’ve tried to capture what seem to be the universal rules about a front matter block:\n\n* The starting and ending delimiters are `---`s on lines by themselves. Trailing whitespace is allowed, but leading whitespace is not. If there is trailing non-whitespace content on the same line, the delimiter is ignored.\n* The starting delimiter must be on the very first line of the file.\n* The very next valid delimiter encountered is treated as the ending delimiter. All other content in the file — even another line that would count as a valid delimiter — is treated as the remainder, because the front matter block is complete.\n* Any would-be front matter block that _opens_ but never _closes_ is not treated as a front matter block.\n\n[Pulsar]: https://pulsar-edit.dev\n[tree-sitter]: https://github.com/tree-sitter/tree-sitter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavetheclocktower%2Ftree-sitter-frontmatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsavetheclocktower%2Ftree-sitter-frontmatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsavetheclocktower%2Ftree-sitter-frontmatter/lists"}