{"id":19348153,"url":"https://github.com/linb/prism-python","last_synced_at":"2025-07-30T08:04:32.884Z","repository":{"id":109496053,"uuid":"343883993","full_name":"linb/prism-python","owner":"linb","description":"It's a python syntax parser based on prismjs - create a parse tree for  246 languages","archived":false,"fork":false,"pushed_at":"2021-03-02T19:30:54.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T01:37:06.108Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/linb.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-02T19:10:13.000Z","updated_at":"2021-03-02T19:30:56.000Z","dependencies_parsed_at":"2023-05-28T04:30:44.167Z","dependency_job_id":null,"html_url":"https://github.com/linb/prism-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/linb/prism-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linb%2Fprism-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linb%2Fprism-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linb%2Fprism-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linb%2Fprism-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linb","download_url":"https://codeload.github.com/linb/prism-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linb%2Fprism-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267834738,"owners_count":24151634,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10T04:19:11.991Z","updated_at":"2025-07-30T08:04:32.851Z","avatar_url":"https://github.com/linb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"It's a python syntax parser based on prismjs - create a parse tree for 246 languages.\n\nInput code:\n```javascript\nconst Prism = require('prismjs');\nconst loadLanguages = require('prismjs/components/');\nloadLanguages(['haml']);\n\n// The code snippet you want to highlight, as a string\nconst code = `= ['hi', 'there', 'reader!'].join \" \"`;\n\n// Returns a highlighted HTML string\nconst html = Prism.highlight(code, Prism.languages.haml, 'haml');\n```\n\nOutput parse tree:\n```\n0 {'type': 'enter', 'content': '\\n', 'alias': None, 'length': 1, 'position': 0}\n1 {'type': 'keyword', 'content': 'const', 'alias': None, 'length': 5, 'position': 1}\n2 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 6}\n3 {'type': 'assign-left', 'content': 'Prism', 'alias': None, 'length': 5, 'position': 7}\n4 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 12}\n5 {'type': 'operator', 'content': '=', 'alias': None, 'length': 1, 'position': 13}\n6 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 14}\n7 {'type': 'function', 'content': 'require', 'alias': None, 'length': 7, 'position': 15}\n8 {'type': 'punctuation', 'content': '(', 'alias': None, 'length': 1, 'position': 22}\n9 {'type': 'string', 'content': \"'prismjs'\", 'alias': None, 'length': 9, 'position': 23}\n10 {'type': 'punctuation', 'content': ')', 'alias': None, 'length': 1, 'position': 32}\n11 {'type': 'punctuation', 'content': ';', 'alias': None, 'length': 1, 'position': 33}\n12 {'type': 'enter', 'content': '\\n', 'alias': None, 'length': 1, 'position': 34}\n13 {'type': 'keyword', 'content': 'const', 'alias': None, 'length': 5, 'position': 35}\n14 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 40}\n15 {'type': 'assign-left', 'content': 'loadLanguages', 'alias': None, 'length': 13, 'position': 41}\n16 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 54}\n17 {'type': 'operator', 'content': '=', 'alias': None, 'length': 1, 'position': 55}\n18 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 56}\n19 {'type': 'function', 'content': 'require', 'alias': None, 'length': 7, 'position': 57}\n20 {'type': 'punctuation', 'content': '(', 'alias': None, 'length': 1, 'position': 64}\n21 {'type': 'string', 'content': \"'prismjs/components/'\", 'alias': None, 'length': 21, 'position': 65}\n22 {'type': 'punctuation', 'content': ')', 'alias': None, 'length': 1, 'position': 86}\n23 {'type': 'punctuation', 'content': ';', 'alias': None, 'length': 1, 'position': 87}\n24 {'type': 'enter', 'content': '\\n', 'alias': None, 'length': 1, 'position': 88}\n25 {'type': 'function', 'content': 'loadLanguages', 'alias': None, 'length': 13, 'position': 89}\n26 {'type': 'punctuation', 'content': '(', 'alias': None, 'length': 1, 'position': 102}\n27 {'type': 'punctuation', 'content': '[', 'alias': None, 'length': 1, 'position': 103}\n28 {'type': 'string', 'content': \"'haml'\", 'alias': None, 'length': 6, 'position': 104}\n29 {'type': 'punctuation', 'content': ']', 'alias': None, 'length': 1, 'position': 110}\n30 {'type': 'punctuation', 'content': ')', 'alias': None, 'length': 1, 'position': 111}\n31 {'type': 'punctuation', 'content': ';', 'alias': None, 'length': 1, 'position': 112}\n32 {'type': 'enter', 'content': '\\n\\n', 'alias': None, 'length': 2, 'position': 113}\n33 {'type': 'comment', 'content': '// The code snippet you want to highlight, as a string', 'alias': None, 'length': 54, 'position': 115}\n34 {'type': 'enter', 'content': '\\n', 'alias': None, 'length': 1, 'position': 169}\n35 {'type': 'keyword', 'content': 'const', 'alias': None, 'length': 5, 'position': 170}\n36 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 175}\n37 {'type': 'assign-left', 'content': 'code', 'alias': None, 'length': 4, 'position': 176}\n38 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 180}\n39 {'type': 'operator', 'content': '=', 'alias': None, 'length': 1, 'position': 181}\n40 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 182}\n41 {'type': 'template-string', 'content': '`= [\\'hi\\', \\'there\\', \\'reader!\\'].join \" \"`', 'alias': None, 'length': 39, 'position': 183}\n42 {'type': 'punctuation', 'content': ';', 'alias': None, 'length': 1, 'position': 222}\n43 {'type': 'enter', 'content': '\\n\\n', 'alias': None, 'length': 2, 'position': 223}\n44 {'type': 'comment', 'content': '// Returns a highlighted HTML string', 'alias': None, 'length': 36, 'position': 225}\n45 {'type': 'enter', 'content': '\\n', 'alias': None, 'length': 1, 'position': 261}\n46 {'type': 'keyword', 'content': 'const', 'alias': None, 'length': 5, 'position': 262}\n47 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 267}\n48 {'type': 'assign-left', 'content': 'html', 'alias': None, 'length': 4, 'position': 268}\n49 {'type': 'assign-right', 'content': 'Prism', 'length': 5, 'position': 275, 'merged': 1}\n50 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 272}\n51 {'type': 'operator', 'content': '=', 'alias': None, 'length': 1, 'position': 273}\n52 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 274}\n53 {'type': 'punctuation', 'content': '.', 'alias': None, 'length': 1, 'position': 280}\n54 {'type': 'function', 'content': 'highlight', 'alias': None, 'length': 9, 'position': 281}\n55 {'type': 'punctuation', 'content': '(', 'alias': None, 'length': 1, 'position': 290}\n56 {'type': 'unknown', 'content': 'code', 'alias': None, 'length': 4, 'position': 291}\n57 {'type': 'punctuation', 'content': ',', 'alias': None, 'length': 1, 'position': 295}\n58 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 296}\n59 {'type': 'unknown', 'content': 'Prism', 'alias': None, 'length': 5, 'position': 297}\n60 {'type': 'punctuation', 'content': '.', 'alias': None, 'length': 1, 'position': 302}\n61 {'type': 'unknown', 'content': 'languages', 'alias': None, 'length': 9, 'position': 303}\n62 {'type': 'punctuation', 'content': '.', 'alias': None, 'length': 1, 'position': 312}\n63 {'type': 'unknown', 'content': 'haml', 'alias': None, 'length': 4, 'position': 313}\n64 {'type': 'punctuation', 'content': ',', 'alias': None, 'length': 1, 'position': 317}\n65 {'type': 'blank', 'content': ' ', 'alias': None, 'length': 1, 'position': 318}\n66 {'type': 'string', 'content': \"'haml'\", 'alias': None, 'length': 6, 'position': 319}\n67 {'type': 'punctuation', 'content': ')', 'alias': None, 'length': 1, 'position': 325}\n68 {'type': 'punctuation', 'content': ';', 'alias': None, 'length': 1, 'position': 326}\n69 {'type': 'enter', 'content': '\\n', 'alias': None, 'length': 1, 'position': 327}\n70 {'type': 'blank', 'content': '    ', 'alias': None, 'length': 4, 'position': 328}\n```\nIt can support all 246 languages in PrismJS. Easy to convert PrismJS language component settings from javascript to python. Here, 4 languages have been converted: Javscript, Python, Bash and Clike.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinb%2Fprism-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinb%2Fprism-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinb%2Fprism-python/lists"}