{"id":27648144,"url":"https://github.com/stackexchange/prosemirror-lezer","last_synced_at":"2026-01-23T07:34:42.033Z","repository":{"id":45685682,"uuid":"513616959","full_name":"StackExchange/prosemirror-lezer","owner":"StackExchange","description":"Experimental ProseMirror syntax highlighting plugin that uses Lezer grammars","archived":false,"fork":false,"pushed_at":"2022-07-18T21:10:21.000Z","size":680,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T06:04:40.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StackExchange.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-13T17:42:16.000Z","updated_at":"2025-04-01T14:08:22.000Z","dependencies_parsed_at":"2022-08-04T19:01:01.999Z","dependency_job_id":null,"html_url":"https://github.com/StackExchange/prosemirror-lezer","commit_stats":null,"previous_names":["stackexchange/prosemirror-lezer"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2Fprosemirror-lezer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2Fprosemirror-lezer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2Fprosemirror-lezer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StackExchange%2Fprosemirror-lezer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StackExchange","download_url":"https://codeload.github.com/StackExchange/prosemirror-lezer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250546512,"owners_count":21448347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-04-24T02:23:08.468Z","updated_at":"2026-01-23T07:34:42.000Z","avatar_url":"https://github.com/StackExchange.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# prosemirror-lezer\n\n\u003e **Warning**\n\u003e This is an **experimental** plugin forked from [b-kelly/prosemirror-highlightjs](https://github.com/b-kelly/prosemirror-highlightjs). In its current state, this **should not be used in production**, as I'm not sure if I'll be maintaining this moving forward.\n\n## Usage\n\n```js\nimport { parser } from \"@lezer/markdown\";\nimport { highlightPlugin } from \"prosemirror-lezer\";\n\n// parsers are keyed by language or optionally `*` as a fallback\nconst parsers = {\n    \"markdown\": parser,\n};\n\nlet state = new EditorView(..., {\n  state: EditorState.create({\n    doc: ...,\n    plugins: [highlightPlugin(parsers)],\n  })\n});\n```\n\nOr import just the decoration parser and write your own plugin:\n\n```js\nimport { getHighlightDecorations } from \"prosemirror-lezer\";\n\nlet plugin = new Plugin({\n    state: {\n        init(config, instance) {\n            let content = getHighlightDecorations(\n                instance.doc,\n                parsers,\n                blockTypes,\n                languageExtractor\n            );\n            return DecorationSet.create(instance.doc, content);\n        },\n        apply(tr, set) {\n            if (!tr.docChanged) {\n                return set.map(tr.mapping, tr.doc);\n            }\n\n            let content = getHighlightDecorations(\n                tr.doc,\n                parsers,\n                blockTypes,\n                languageExtractor\n            );\n            return DecorationSet.create(tr.doc, content);\n        },\n    },\n    props: {\n        decorations(state) {\n            return this.getState(state);\n        },\n    },\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackexchange%2Fprosemirror-lezer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstackexchange%2Fprosemirror-lezer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstackexchange%2Fprosemirror-lezer/lists"}