Ember Code Prettify
Ember Code Prettify exposes a service to render Google Code Prettify syntax highlighting in Ember.js applications.
Installation
ember install ember-code-prettify
Configuration
With no configuration, Ember Code Prettify will use the default skin and languages. The following config imports the css & yaml languages extensions and uses the desert skin:
// config/environment.jsENV'ember-code-prettify' = languages: 'css' 'yaml' skin: 'desert';
Usage
Ember Code Prettify exposes a service codePrettify
. It can be used to paint the syntax highlighting in routes and components.
Firstly ensure your code snippet is formatted like so:
console.log('This will be painted');
Then get prettify to render using:
;
Routes
If code snippets are added statically to a route template, simply fire Ember Code Prettify in an afterRender
hook.
;;;; ;
Components
For code snippets added to component templates, use the didRender
hook. Be warned, this hook will fire on any subsequent render of the component.
;;; ;
Contributing
Installation
git clone <repository-url>
this repositorycd ember-code-prettify
npm install
Test App
ember serve
- Visit your app at http://localhost:4200.
Tests
npm test
(Runsember try:each
to test your addon against multiple Ember versions)ember test
ember test --server