{"id":15634779,"url":"https://github.com/ioquatix/jquery-syntax","last_synced_at":"2025-09-11T13:32:32.351Z","repository":{"id":809943,"uuid":"517247","full_name":"ioquatix/jquery-syntax","owner":"ioquatix","description":"jQuery.Syntax is a light-weight client-side syntax highlighter.","archived":false,"fork":false,"pushed_at":"2020-05-18T14:42:02.000Z","size":6412,"stargazers_count":129,"open_issues_count":1,"forks_count":27,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-05-01T23:58:52.572Z","etag":null,"topics":["javascript","jquery","jquery-syntax","syntax-highlighting"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ioquatix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-02-14T04:17:16.000Z","updated_at":"2023-09-08T16:26:24.000Z","dependencies_parsed_at":"2022-07-05T16:31:30.164Z","dependency_job_id":null,"html_url":"https://github.com/ioquatix/jquery-syntax","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Fjquery-syntax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Fjquery-syntax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Fjquery-syntax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioquatix%2Fjquery-syntax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ioquatix","download_url":"https://codeload.github.com/ioquatix/jquery-syntax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232654806,"owners_count":18556468,"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":["javascript","jquery","jquery-syntax","syntax-highlighting"],"created_at":"2024-10-03T10:57:09.227Z","updated_at":"2025-01-05T23:30:33.248Z","avatar_url":"https://github.com/ioquatix.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jQuery.Syntax\n\njQuery.Syntax is a light-weight client-side syntax highlighter, which dynamically loads external dependencies (JavaScript \u0026 CSS) when required. It uses jQuery to make it cross-browser compatible and to simplify integration and integration with other systems.\n\n## Motivation\n\njQuery.Syntax was built at a time when syntax highlighting on the web was a bit of a mess - browser incompatibilities and limitations made it hard to do the right thing consistently. Rather than a single definition of \"good\", presenting code nicely in a browser was dictated by a set of trade-offs.\n\nAt the time, syntax highlighters were often all-or-nothing - this made it cumbersome for sites that only had a few pages with code on them. jQuery.Syntax was designed from the ground up to use dynamic loading of assets when required. On top of that, the implementation was built using a profiler and is fairly efficient.\n\nIt's a good library and it's fast, that's why I continue to maintain and develop it.\n\n### Isn't jQuery big?\n\nYour right, small is pretty subjective.\n\njQuery as a dependency is based on a design from 2012. When browsers were a bit less \"compatible\", this was a good trade-off. These days, it could probably be removed, but it isn't worth the effort and for me personally it's a zero-cost dependency since I use it anyway on most of my sites.\n\nThe library is modular and only loads exactly the CSS and JS required. The minimised and gzipped library is 1.6Kbytes, this provide the top-level API and the dynamic loading functionality.\n\nTo highlight anything, you need to load the core parser and renderer code. It's 4.1Kbytes minified and gzipped. The CSS and Script files are tiny, most less \u003c 1Kbyte, per language.\n\n### Compared to xyz?\n\nAll syntax highlighters are pretty good these days. But, there are some key differences worth considering:\n\n- How much does it load by default, even when not highlighting anything?\n- How efficient/fast is it when highlighting code?\n- How does line wrapping work?\n- Can you embed `\u003cspan\u003e` and `\u003ca\u003e` elements?\n- Can it handle embedded code (e.g. JavaScript inside HTML)?\n- Is it easy to install?\n- Is it easy to customize?\n\n## Installation\n\njQuery.Syntax is easily installed using `yarn`.\n\n\t$ yarn install jquery-syntax\n\nIt has a `dist/` directory which follows standard conventions.\n\n### Advanced Configuration\n\njQuery.Syntax compiles and minifies it's code using uses [`bake`](https://github.com/ioquatix/bake) (Ruby) and [Sass](http://sass-lang.com). Please review the included `bake.rb` and `install.yaml` for more details.\n\n## Usage\n\njQuery.Syntax is typically used to highlight both block code elements and inline code elements. To highlight code, you first need to include several scripts in the `\u003chead\u003e` of your page:\n\n\t\u003c!-- Put in your head tag --\u003e\n\t\u003cscript src=\"jquery.min.js\"\u003e\u003c/script\u003e\n\t\u003cscript src=\"jquery.syntax.min.js\"\u003e\u003c/script\u003e\n\t\n\t\u003cscript type=\"text/javascript\"\u003e\n\t\t// This function is executed when the page has finished loading.\n\t\tjQuery(function($) {\n\t\t\t$.syntax({theme: 'bright'});\n\t\t});\n\t\u003c/script\u003e\n\t\n\t\u003c!-- Your code to highlight --\u003e\n\t\u003cpre\u003e\u003ccode class=\"language-ruby\"\u003eputs \"Hello World\"\u003c/code\u003e\u003c/pre\u003e\n\n### Stylesheet Compatibility\n\nThe following stylesheet sets some useful defaults and enables responsive tab-size indentation.\n\n```css\nhtml {\n\tfont-size: 16px;\n\t\n\t/* Fix odd text-size in `display: flex` elements on Safari iOS */\n\ttext-size-adjust: 100%;\n\t-webkit-text-size-adjust: 100%;\n}\n\n@media (min-width: 40em) {\n\thtml {\n\t\tfont-size: 18px;\n\t\t--tab-size: 4;\n\t}\n}\n\n@media (min-width: 80em) {\n\thtml {\n\t\tfont-size: 20px;\n\t\t--tab-size: 4;\n\t}\n}\n\npre {\n\t/* -moz-tab-size is still required by Firefox */\n\t--tab-size: 2;\n\ttab-size: var(--tab-size);\n\t-moz-tab-size: var(--tab-size);\n}\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## License\n\nReleased under the MIT license.\n\nCopyright, 2011-2020, by [Samuel G. D. Williams](https://www.codeotaku.com/).\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioquatix%2Fjquery-syntax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fioquatix%2Fjquery-syntax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioquatix%2Fjquery-syntax/lists"}