Security News
Combatting Alert Fatigue by Prioritizing Malicious Intent
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
angular-prism
Advanced tools
To install this library, run:
$ npm install angular-prism --save
Include the required prism theme CSS in your index.html or plug into your build System
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/themes/prism-okaidia.min.css"/>
Configure your System.config
System.config({
defaultJSExtensions: true,
map: {
"angular2": "node_modules/angular2",
"rxjs": "node_modules/rxjs",
...
"prismjs": "node_modules/prismjs"
"angular-prism" : "node_modules/angular-prism/dist"
},
packages: {
'app': {
main : './main.ts',
defaultJSExtensions : 'ts'
},
'prismjs' : {
defaultExtension : 'js'
},
'angular-prism' : {
main : './angular-prism.js',
defaultExtension : 'js'
}
}
});
and then from your Angular AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
/* Import prism core */
import 'prismjs/prism';
/* Import the language you need to highlight */
import 'prismjs/components/prism-typescript';
import { PrismComponent } from 'angular-prism';
@NgModule({
declarations: [
AppComponent,
PrismComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
and in your component which displays code block
@Component({
selector: 'my-app',
template: `
<div>
<prism-block [code]="cssCode" [language]="'css'"></prism-block>
</div>
`,
})
export class MyComponent {
cssCode : string;
constructor() {
this.cssCode = `p {
color:red;
}`;
}
}
To generate all *.js
, *.js.map
and *.d.ts
files:
$ npm run tsc
To lint all *.ts
files:
$ npm run lint
MIT © Vaibhav Bansal
FAQs
Minimal PrismJS component for code highlighting in Angular 2/4
We found that angular-prism demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.