Simple Angular 2+ Prism highlighter module with Rxjs. Click to go to package without Rxjs.
- Component changeDetection is set to
OnPush, it gives better overall performance.
- Dynamically change highlight string with
- Interpolate string to highlight with
rxjs/Subjectto Subscribe to
asynctrue does not work properly.
- Hooks are defined globally.
If you want to see how @ngx-prism/rxjs works with @angular/cli, get simple example demonstration usage from github repository by opening your command line and do the following:
git clone https://github.com/ngx-prism/demo.git
Go to file
src/app/app.module.ts line 3 comment it, and uncomment line 4.
Go to file
src/style.css comment line 2 and uncomment line 3.
npm install && npm start
Open http://localhost:4200/ in your browser.
To install, run:
npm install @ngx-prism/rxjs --save
PrismModuleinto your module.
- Use prism component in your example component.
PrismComponent by providing
interpolation property in
- It is possible to import themes files in
It is designed to use
ng-content and property
code separately. You can NOT use both the same time.
|async||boolean||Works only with
|callback||(element: Element) => void | undefined = undefined||"An optional callback to be invoked after the highlighting is done. Mostly useful when async is true, since in that case, the highlighting is done asynchronously." - prismjs|
|code||string||"A string with the code to be highlighted." - prismjs|
|hooks||Object||Callback with specific execute time and name:
|interpolation||Object | undefined||Data property values to inject.|
highlightElement(element, async, callback) prismjs method.
Detect input property
language changes by comparing
If yes, set component property
Unsubscribe Rxjs.Subject subscription in Object property
Initiate subscribes to property
git clone https://github.com/ngx-prism/rxjs.git
Go to just created folder:
To build a clean package, means before that script removes node_modules, dist folder and install dependencies:
npm run start:clean
To build a package:
To run karma tests:
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
FAQ How should I deal with revisions in the 0.y.z initial development phase?
The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.
How do I know when to release 1.0.0?
If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.
MIT © ngx-prism