{"id":13895744,"url":"https://github.com/leafo/lua-syntaxhighlight","last_synced_at":"2025-05-12T20:36:04.263Z","repository":{"id":66222851,"uuid":"210767031","full_name":"leafo/lua-syntaxhighlight","owner":"leafo","description":"A code syntax to HTML highlighter using lexers from Textadept","archived":false,"fork":false,"pushed_at":"2023-04-09T13:55:46.000Z","size":274,"stargazers_count":22,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-20T17:39:48.502Z","etag":null,"topics":["lua","syntax-highlighting","textadept"],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/leafo.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":"2019-09-25T06:01:25.000Z","updated_at":"2024-11-05T06:00:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c26edcf-7237-4ac7-ac20-a32f2920e6e1","html_url":"https://github.com/leafo/lua-syntaxhighlight","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flua-syntaxhighlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flua-syntaxhighlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flua-syntaxhighlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leafo%2Flua-syntaxhighlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leafo","download_url":"https://codeload.github.com/leafo/lua-syntaxhighlight/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253817574,"owners_count":21969004,"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":["lua","syntax-highlighting","textadept"],"created_at":"2024-08-06T18:02:26.537Z","updated_at":"2025-05-12T20:36:04.234Z","avatar_url":"https://github.com/leafo.png","language":"Lua","readme":"\n# syntaxhighlight\n\n![test](https://github.com/leafo/lua-syntaxhighlight/workflows/test/badge.svg)\n\nHighlights code into HTML using lexers from [Textadept](https://foicica.com/textadept/).\n\n\n```lua\nlocal sh = require(\"syntaxhighlight\")\n\nlocal html = sh.highlight_to_html(\"lua\", [[\n\nlocal function hello_world(times)\n  for i=1,times do\n    print(\"hello world\")\n  end\nend\n\n]])\n\nprint(html)\n```\n\n\nOutput:\n\n\n```html\n\u003cpre class=\"sh_highlight\"\u003e\u003cspan class=\"sh_keyword\"\u003elocal\u003c/span\u003e \u003cspan class=\"sh_keyword\"\u003efunction\u003c/span\u003e \u003cspan class=\"sh_identifier\"\u003ehello_world\u003c/span\u003e\u003cspan class=\"sh_operator\"\u003e(\u003c/span\u003e\u003cspan class=\"sh_identifier\"\u003etimes\u003c/span\u003e\u003cspan class=\"sh_operator\"\u003e)\u003c/span\u003e\n  \u003cspan class=\"sh_keyword\"\u003efor\u003c/span\u003e \u003cspan class=\"sh_identifier\"\u003ei\u003c/span\u003e\u003cspan class=\"sh_operator\"\u003e=\u003c/span\u003e\u003cspan class=\"sh_number\"\u003e1\u003c/span\u003e\u003cspan class=\"sh_operator\"\u003e,\u003c/span\u003e\u003cspan class=\"sh_identifier\"\u003etimes\u003c/span\u003e \u003cspan class=\"sh_keyword\"\u003edo\u003c/span\u003e\n    \u003cspan class=\"sh_function\"\u003eprint\u003c/span\u003e\u003cspan class=\"sh_operator\"\u003e(\u003c/span\u003e\u003cspan class=\"sh_string\"\u003e\u0026quot;hello world\u0026quot;\u003c/span\u003e\u003cspan class=\"sh_operator\"\u003e)\u003c/span\u003e\n  \u003cspan class=\"sh_keyword\"\u003eend\u003c/span\u003e\n\u003cspan class=\"sh_keyword\"\u003eend\u003c/span\u003e\n\u003c/pre\u003e\n```\n\n## Interface\n\n### `highlight_to_html(language_name, code, opts={})`\n\nHighlights code using the lexer for `language_name`. All input code is HTML escaped and is safe to embed directly into a page.\n\nOptions:\n\n* `class_prefix` -- default `sh_`: Prefix put in front of every class name generated for each element\n* `bare` -- default `false`: Set to `true` to not return the code wrapped in a `pre` tag\n\n\n## License\n\n### Files located in `syntaxhighlight/textadept/`\n\n*See respective authors on top of each file*\n\nThe MIT License\n\nCopyright (c) 2007-2019 Mitchell\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n### Everything else\n\nThe MIT License\n\nCopyright (c) 2020 Leaf Corcoran\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","funding_links":[],"categories":["Lua"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Flua-syntaxhighlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleafo%2Flua-syntaxhighlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleafo%2Flua-syntaxhighlight/lists"}