![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
angular2-highlight-js
Advanced tools
[highlight.js](https://highlightjs.org) integration with Angular.
highlight.js integration with Angular.
npm install --save angular2-highlight-js@latest highlight.js
Add the highlight.js css for the style you want to use to your app's styles in angular.json.
"styles": [
"./node_modules/highlight.js/styles/monokai-sublime.css",
...
],
In app.module.ts import the highlight.js library and any languages you will be highlighting.
import { registerLanguage } from 'highlight.js';
import javascript from 'highlight.js/lib/languages/javascript';
import typescript from 'highlight.js/lib/languages/typescript';
registerLanguage('typescript', typescript);
registerLanguage('javascript', javascript);
Import the AngularHighlightJsModule.
import { AngularHighlightJsModule } from 'angular2-highlight-js';
@NgModule({
declarations: [AppComponent],
imports: [...AngularHighlightJsModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
This library contains the HighlightJsContentDirective Below are usage notes for each. A demo app is also available as in the repo.
Use this to highlight the contents of and element which will be set dynamically (by setting innerHTML for example).
Import the directive and declare it.
@Component({
selector: 'demo',
templateUrl: 'demo.component.html',
styleUrls: ['demo.component.css']
})
Add the attribute hljsContent to the element which will have content that requires highlighting. When the content is changed the directive will look for all child elements which match the selector provided and highlight them. If no selector is given it will default to finding all code elements.
<section [innerHTML]="sampleContent" hljsContent=".highlight"></section>
You can configure highlight.js by using the [options] property on the directive
<section
[innerHTML]="sampleContent"
hljsContent=".highlight"
[options]="{ useBr: true }"
></section>
FAQs
[highlight.js](https://highlightjs.org) integration with Angular.
We found that angular2-highlight-js 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.