{"id":19719373,"url":"https://github.com/vaibhav93/angular-prism","last_synced_at":"2025-04-29T21:30:25.831Z","repository":{"id":57178975,"uuid":"87462213","full_name":"vaibhav93/angular-prism","owner":"vaibhav93","description":"Minimal PrismJS component for code highlighting in Angular 2/4","archived":false,"fork":false,"pushed_at":"2018-04-02T17:24:52.000Z","size":26,"stargazers_count":17,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T10:38:54.600Z","etag":null,"topics":["angular2","angular2-component","angular4","angular4-component","typescript"],"latest_commit_sha":null,"homepage":"https://plnkr.co/edit/5z6Keq?p=preview","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaibhav93.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-06T18:33:59.000Z","updated_at":"2022-08-30T05:25:47.000Z","dependencies_parsed_at":"2022-09-09T17:12:18.756Z","dependency_job_id":null,"html_url":"https://github.com/vaibhav93/angular-prism","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaibhav93%2Fangular-prism","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaibhav93%2Fangular-prism/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaibhav93%2Fangular-prism/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaibhav93%2Fangular-prism/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaibhav93","download_url":"https://codeload.github.com/vaibhav93/angular-prism/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251585712,"owners_count":21613267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular2","angular2-component","angular4","angular4-component","typescript"],"created_at":"2024-11-11T23:08:06.199Z","updated_at":"2025-04-29T21:30:25.465Z","avatar_url":"https://github.com/vaibhav93.png","language":"TypeScript","readme":"# angular-prism\n\n## [ View Demo ](https://plnkr.co/edit/5z6Keq?p=preview)\n\n## Installation\n\nTo install this library, run:\n\n```bash\n$ npm install angular-prism --save\n```\n\n## Usage\nInclude the required prism theme CSS in your index.html or plug into your build System\n```xml\n\u003clink rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/prism/1.6.0/themes/prism-okaidia.min.css\"/\u003e\n```\nConfigure your System.config\n```javascript\nSystem.config({\n  defaultJSExtensions: true,\n  map: {\n    \"angular2\": \"node_modules/angular2\",\n    \"rxjs\": \"node_modules/rxjs\",\n    ...\n    \"prismjs\": \"node_modules/prismjs\"\n    \"angular-prism\" : \"node_modules/angular-prism/dist\"\n  },\n  packages: {        \n    'app': {\n      main : './main.ts',\n      defaultJSExtensions : 'ts'\n    },\n    'prismjs' : {\n      defaultExtension : 'js'\n    },\n    'angular-prism' : {\n      main : './angular-prism.js',\n      defaultExtension : 'js'\n    }\n  }\n});\n```\nand then from your Angular `AppModule`:\n\n```typescript\nimport { BrowserModule } from '@angular/platform-browser';\nimport { NgModule } from '@angular/core';\n\nimport { AppComponent } from './app.component';\n\n/* Import prism core */\nimport 'prismjs/prism';\n\n/* Import the language you need to highlight */\nimport 'prismjs/components/prism-typescript';\n\nimport { PrismComponent } from 'angular-prism';\n\n@NgModule({\n  declarations: [\n    AppComponent,\n    PrismComponent\n  ],\n  imports: [\n    BrowserModule\n  ],\n  providers: [],\n  bootstrap: [AppComponent]\n})\nexport class AppModule { }\n```\nand in your component which displays code block\n```typescript\n@Component({\n  selector: 'my-app',\n  template: `\n    \u003cdiv\u003e\n      \u003cprism-block [code]=\"cssCode\" [language]=\"'css'\"\u003e\u003c/prism-block\u003e\n    \u003c/div\u003e\n  `,\n})\nexport class MyComponent {\n  cssCode : string;\n\n  constructor() {\n    this.cssCode = `p {\n                      color:red;\n                    }`;\n\n    }\n}\n```\n\n## Development\n\nTo generate all `*.js`, `*.js.map` and `*.d.ts` files:\n\n```bash\n$ npm run tsc\n```\n\nTo lint all `*.ts` files:\n\n```bash\n$ npm run lint\n```\n\n## License\n\nMIT © [Vaibhav Bansal](mailto:vaibhavbansal1993@gmail.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaibhav93%2Fangular-prism","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaibhav93%2Fangular-prism","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaibhav93%2Fangular-prism/lists"}