{"id":16318057,"url":"https://github.com/willviles/ember-code-prettify","last_synced_at":"2025-03-22T21:31:42.650Z","repository":{"id":48246022,"uuid":"103284041","full_name":"willviles/ember-code-prettify","owner":"willviles","description":"Ember.js addon for using Google Code Prettify syntax highlighting.","archived":false,"fork":false,"pushed_at":"2022-12-07T04:52:15.000Z","size":943,"stargazers_count":10,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T14:53:49.918Z","etag":null,"topics":["code","ember","ember-addon","google-code-prettify","prettify","syntax-highlighting"],"latest_commit_sha":null,"homepage":null,"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/willviles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-12T14:52:53.000Z","updated_at":"2024-05-30T03:19:37.000Z","dependencies_parsed_at":"2023-01-24T13:30:39.108Z","dependency_job_id":null,"html_url":"https://github.com/willviles/ember-code-prettify","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/willviles%2Fember-code-prettify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-code-prettify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-code-prettify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-code-prettify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willviles","download_url":"https://codeload.github.com/willviles/ember-code-prettify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245022594,"owners_count":20548565,"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":["code","ember","ember-addon","google-code-prettify","prettify","syntax-highlighting"],"created_at":"2024-10-10T22:09:51.347Z","updated_at":"2025-03-22T21:31:42.291Z","avatar_url":"https://github.com/willviles.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ember Code Prettify ![Download count all time](https://img.shields.io/npm/dt/ember-code-prettify.svg) [![npm](https://img.shields.io/npm/v/ember-code-prettify.svg)](https://www.npmjs.com/package/ember-code-prettify)\n======\n\nEmber Code Prettify exposes a service to fire [Google Code Prettify](https://github.com/google/code-prettify) syntax highlighting in Ember.js routes and components.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/2046935/30334052-64dfba90-97d6-11e7-9b5e-8be0fa80682c.png\" width=\"auto\" height=\"auto\"\u003e\n\n## Installation\n\n```\nember install ember-code-prettify\n```\n\n## Configuration\n\nWith no configuration, Ember Code Prettify will use the default skin and languages. The following config imports the css \u0026 yaml languages extensions and uses the desert skin:\n\n```js\n// config/environment.js\nENV['ember-code-prettify'] = {\n  languages: ['css', 'yaml'],\n  skin: 'desert'\n};\n```\n\n## Usage\n\nEmber Code Prettify exposes a service `codePrettify`. It can be used to paint the syntax highlighting in routes and components.\n\nFirstly ensure your code snippet is formatted like so:\n\n```html\n\u003cpre class=\"prettyprint lang-js\"\u003e\n  console.log('This will be painted');\n\u003c/pre\u003e\n```\n\nThen get prettify to render using:\n\n```js\nget(this, 'codePrettify').prettify();\n```\n\n### Routes\n\nIf code snippets are added statically to a route template, simply fire Ember Code Prettify in an `afterRender` hook.\n\n```javascript\nimport Route from '@ember/routing/route';\nimport { get } from '@ember/object';\nimport { scheduleOnce } from '@ember/runloop';\nimport { inject } from '@ember/service';\n\nexport default Route.extend({\n  codePrettify: inject(),\n\n  init() {\n    scheduleOnce('afterRender', this, function() {\n      get(this, 'codePrettify').prettify();\n    });\n  }\n});\n```\n\n### Components\n\nFor code snippets added to component templates, use the `didRender` hook. Be warned, this hook will fire on any subsequent render of the component.\n\n```javascript\nimport Component from '@ember/component';\nimport { get } from '@ember/object';\nimport { inject } from '@ember/service';\n\nexport default Component.extend({\n  codePrettify: inject(),\n\n  didRender() {\n    get(this, 'codePrettify').prettify();\n  }\n});\n```\n\n## Contributing\n\n### Installation\n\n* `git clone \u003crepository-url\u003e` this repository\n* `cd ember-code-prettify`\n* `npm install`\n\n### Test App\n\n* `ember serve`\n* Visit your app at [http://localhost:4200](http://localhost:4200).\n\n### Tests\n\n* `npm test` (Runs `ember try:each` to test your addon against multiple Ember versions)\n* `ember test`\n* `ember test --server`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillviles%2Fember-code-prettify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillviles%2Fember-code-prettify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillviles%2Fember-code-prettify/lists"}