{"id":15501842,"url":"https://github.com/gadicc/meteor-syntaxhighlighter","last_synced_at":"2025-10-19T09:17:21.487Z","repository":{"id":9326228,"uuid":"11171181","full_name":"gadicc/meteor-SyntaxHighlighter","owner":"gadicc","description":"Alex Gorbatchev SyntaxHighlighter, *client-side*","archived":false,"fork":false,"pushed_at":"2014-09-25T08:40:46.000Z","size":454,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-17T21:19:16.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","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/gadicc.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-07-04T08:32:00.000Z","updated_at":"2017-09-12T14:50:23.000Z","dependencies_parsed_at":"2022-07-31T16:38:59.762Z","dependency_job_id":null,"html_url":"https://github.com/gadicc/meteor-SyntaxHighlighter","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadicc%2Fmeteor-SyntaxHighlighter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadicc%2Fmeteor-SyntaxHighlighter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadicc%2Fmeteor-SyntaxHighlighter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gadicc%2Fmeteor-SyntaxHighlighter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gadicc","download_url":"https://codeload.github.com/gadicc/meteor-SyntaxHighlighter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247321077,"owners_count":20919913,"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":"2024-10-02T09:06:02.465Z","updated_at":"2025-10-19T09:17:21.366Z","avatar_url":"https://github.com/gadicc.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SyntaxHighlighter\n\nA smart package providing Alex Gorbatchev's [SyntaxHighlighter](http://alexgorbatchev.com/SyntaxHighlighter/) on the **client** side.\n\nFor the server side, just use the node-syntaxhighlighter npm package.\n\nIf you have `sp-marked` installed too, SyntaxHighlighter sets itself as the\ndefault highlighter, and will be used automatically with no additional work\non your part in \u003ccode\u003e```js\u003c/code\u003e type markdown escapes.\n\n## Usage\n\n### Method 1: Our way (recommended)\n\nUse in a template like this:\n\n```html\n{{#sh_highlight lang=\"js\"}}function etc() { ... }{{/sh_highlight}}\n```\n\nOr directly in Javascript thus:\n\n```js\nvar highlighted = sh_highlight(text, lang);\n```\n\n### Method 2: Use as \"normal\" (I don't recommend this)\n\nIf you format your \u0026lt;pre\u0026gt; blocks as recommend in the apps documentation, just run SyntaxHighlighter.all() in your template's rendered function.  e.g.\n\n```js\nTemplate.example.rendered = function() {\n    SyntaxHighlighter.all();\n}\n```\n\n### Method 3: For reference, the code used in our helpers\n\n\n```js\n// helper function to choose the right brush\nfunction findBrush(lang) {\n\tfor (brush in SyntaxHighlighter.brushes)\n\t\tfor (var i=0; i \u003c SyntaxHighlighter.brushes[brush].aliases.length; i++)\n\t\t\tif (SyntaxHighlighter.brushes[brush].aliases[i] == lang)\n\t\t\t\treturn SyntaxHighlighter.brushes[brush];\n\treturn false;\n}\n\n// e.g. var highlighted_code = highlight(code, 'js');\nhighlight = function(code, lang) {\n\tvar brush = findBrush(lang);\n\tif (brush) {\n\t\tvar highlighter = new brush();\n\t\thighlighter.init();\n\t\treturn highlighter.getHtml(code);\n\t} else {\n\t\treturn code;\n\t}\n\n// example to plug into the marked smart package\nmarked.setOptions({\n\thighlight: highligh\n});\n```\n\n## Smart package info\n\n1. On deploy, this sends a minified version of all brushes.  It would be preferable to load brushes on demand, but this would require support for static assets in smart packages, which I don't believe exists (yet).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadicc%2Fmeteor-syntaxhighlighter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgadicc%2Fmeteor-syntaxhighlighter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgadicc%2Fmeteor-syntaxhighlighter/lists"}