ngx-codejar
v7.0.3
Published
Angular wrapper for CodeJar supporting Prism.js and Highlight.js. With this you can easily add code-editors to your Angular app.
Downloads
1,924
Maintainers
Readme
ngx-codejar
This is an Angular wrapper for the code-editor CodeJar by Anton Medvedev. It allows to easily use CodeJar in Angular projects.
Demo
Visit the demo page: https://julianpoemp.github.io/ngx-codejar/
About CodeJar
CodeJar is an embeddable javascript code-editor that supports different highlighter like Highlight.js or PrimsJs. According to the main project it has the following features:
- Preserves indentation on a new line
- Adds closing brackets, quotes
- Indents line with the Tab key
- Supports undo/redo
Compatibility
Overview
- Install ngx-codejar with highlight.js
- Install ngx-codejar with prism.js
- Options
- Development
- Contribution
- Troubleshooting
Installation
How to use CodeJar with Angular and highlight.js
If you want to use CodeJar with highlight.js you should do the following steps:
- Install highlight.js, CodeJar, codejar-linenumbers and ngx-codejar:
npm install --save codejar codejar-linenumbers highlight.js ngx-codejar && npm install --save-dev @types/highlight.js
- Import NgxCodeJarComponent
NgxCodeJarComponent
to your app's ngModule import property (standalone!):
@NgModule({
declarations: [
// ...
],
imports: [
// ...,
NgxCodeJarComponent
],
// ...
})
- Select themes from
node_modules/highlight.js/styles
and add them to the styles section of yourangular.json
. - Add
node_modules/codejar-linenumbers/es/codejar-linenumbers.css
to the styles section of yourangular.json
- Now see https://julianpoemp.github.io/ngx-codejar/ on how to use it.
How to use CodeJar with Angular and Prism.js
If you want to use codejar with prism.js you should do the following steps:
- Install prism.js, codejar, codejar-linenumbers and ngx-codejar:
npm install --save codejar codejar-linenumbers prismjs ngx-codejar && npm install --save-dev @types/prismjs
- Import module
NgxCodeJarComponent
to your app's ngModule imports property (!standalone):
@NgModule({
declarations: [
// ...
],
imports: [
// ...,
NgxCodeJarComponent
],
// ...
})
- Select themes from
node_modules/prismjs/themes
and add them to the styles section of yourangular.json
. - Add
node_modules/codejar-linenumbers/es/codejar-linenumbers.css
to the styles section of yourangular.json
- Now see https://julianpoemp.github.io/ngx-codejar/ on how to use it.
Properties & Events
Development
Call npm start
to start the demo locally. Build the library using ng build ngx-codejar
.
Contribution
Feel free to create pull requests or issues with suggestions! :)
Troubleshooting
This package is just a wrapper for CodeJar. If you have any problems using it please make sure, that the problem is related to this wrapper.