Skip to content

Commit 6599e18

Browse files
authored
Merge pull request #4 from ProAngular/ct/template-updates
Ct/template updates
2 parents c5f7e7b + e6e35b7 commit 6599e18

8 files changed

+43
-20
lines changed

README.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
[![Website Status](https://img.shields.io/website?down_color=lightgrey&down_message=Offline&label=Website&up_color=green&up_message=Online&url=https%3A%2F%2Fwww.proangular.com)](https://www.proangular.com)
2020
[![Gitter Chat](https://badges.gitter.im/ProAngular/lobby.svg)](https://gitter.im/ProAngular/community)
2121
[![Discord Chat](https://img.shields.io/discord/1003103094588055552?label=Discord)](https://discord.com/channels/1003103094588055552)
22-
[![GitHub Package Status](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-gpr.yml/badge.svg)](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-gpr.yml)
23-
[![npmjs Package Status](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-npmjs.yml/badge.svg)](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-npmjs.yml)
2422
[![Sponsors](https://img.shields.io/github/sponsors/proangular?label=Sponsors)](https://github.com/sponsors/ProAngular)
2523
[![License](https://img.shields.io/npm/l/express.svg?maxAge=2592000)](/LICENSE)
24+
[![GitHub Package Status](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-gpr.yml/badge.svg)](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-gpr.yml)
25+
[![npmjs Package Status](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-npmjs.yml/badge.svg)](https://github.com/ProAngular/ngx-gist/actions/workflows/on-merge-main-deploy-npmjs.yml)
2626

2727
<!--
2828
[![StackBlitz](https://badgen.net/badge/StackBlitz/Offline/red)]()
@@ -104,12 +104,30 @@ export class FeatureModule { }
104104

105105
## Dependencies
106106

107-
### Styling
107+
### Styling UX - Angular Material
108108

109109
You should have an Angular Material theme set up prior to using this, but it's not strictly neccessary. Disabled by default, you can alternatively use the `materialTheme` component input (see API documentation below) to auto load a pre-defined Angular Material theme from a CDN. I don't recommend depending on the CDN or this approach, but I wanted to make it possible for you. It's also possible to use this without an angular theme and style it yourself entirely!
110110

111111
More information on theming Angular Material: https://material.angular.io/guide/theming
112112

113+
### Styling UX Code Snippets - Highlight.js
114+
115+
You can pass in any theme name (string, excluding the file extension ".css") to the input `codeTheme` on _any_ `ngx-gist` element on a single page which will apply the theme to that pages gists.
116+
117+
You can find the available styles here: https://unpkg.com/browse/highlight.js@11.6.0/styles/
118+
119+
Alternatively if you only want to use one style across the whole project or just apply to specific features, I recommend importing the styles directly. To do this install the `highlight.js` package and apply the style. Example below:
120+
121+
```bash
122+
npm install highlight.js --save
123+
```
124+
125+
```diff
126+
...
127+
+ @import "highlight.js/styles/github.css";
128+
...
129+
```
130+
113131
### Core Packages
114132

115133
Depending on how your project is set up, you may also need the following imports either in your `FeatureModule` for example or your root module (generally these are already imported in `AppModule` or similar, they are common features of Angular). These dependencies are needed for animating the Angular Material tabs click transition and making an HTTP request to GitHub to retrieve the remote gist information.
@@ -216,10 +234,10 @@ Line numbers are enabled by default, but you can turn them off like so.
216234

217235
| Input Name | Input Typing | Default Value | Description |
218236
| ------------------------ | ------------------------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
219-
| **codeTheme** | `HighlightJsTheme` (string) | `'default'` | The `highlight.js` code theme to use and display. Note: Only _one_ theme can be loaded on a single page at a time! The first theme to load will apply to all gists on the page. |
237+
| **codeTheme** | `HighlightJsTheme \| undefined` | `undefined` | The `highlight.js` code theme to use and display. Note: Only _one_ theme can be loaded on a single page at a time! The first theme to load will apply to all gists on the page. Available themes here: https://unpkg.com/browse/highlight.js@11.6.0/styles/ |
220238
| **displayOnlyFileNames** | `string \| string[] \| undefined` | `undefined` | Display in the DOM only the selected filename(s) from the gists files array. Can be either a string or string array. File names much match exactly, be sure to remove any leading or trailing whitespace in the provided strings. |
221239
| **gist** | `NgxGist \| undefined` | `undefined` | Provide a static gist model here directly which will be displayed if no `gistId` is provided for remote fetching. Also this model will be displayed should a fetch fail when retrieving `gistId`, or overwritten once the pertaining `gistId` data is fetched. |
222-
| **gistId** | `string` | `undefined` | Provide the GitHub gist id to be fetched and loaded. This can be found in URL of the gists you create. For example the id `TH1515TH3G15T1D` in: https://gist.github.com/YourUserName/TH1515TH3G15T1D. Alternatively, provide a value directly in the sibling input `gist`. |
240+
| **gistId** | `string` | `undefined` | Provide the GitHub gist id to be fetched and loaded. This can be found in URL of the gists you create. For example the id `TH1515TH3G15T1D` in: https://gist.github.com/YourUserName/TH1515TH3G15T1D. Alternatively, provide a value directly in the sibling input `gist`. |
223241
| **hideGistLink** | `bool` | `false` | Optionally hide the gist link which opens the gist on GitHub. The gist links automatically display for remote gists, but can be hidden with this feature. |
224242
| **materialTheme** | `MaterialPrebuiltTheme \| undefined` | `undefined` | Define a material core theme to apply. Ideally, you should already have your global material theme set at the root of your project so try to avoid using this if possible. Note: These are loaded from the CDN: `https://unpkg.com` |
225243
| **showLineNumbers** | `bool` | `true` | Display or hide the line numbers in your gist code snippets. |

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@proangular/ngx-gist",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "An Angular Material and HighlighJs styled display box for GitHub gist and local code snippets.",
55
"author": "Pro Angular <webmaster@proangular.com>",
66
"homepage": "https://www.proangular.com",

src/app/layout/footer.component.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import { Component } from '@angular/core';
55
template: `
66
<footer [style.height]="height + 'px'">
77
<a href="https://www.ProAngular.com" target="_blank">
8-
<img src="assets/images/pro-angular-logo.png" />
8+
<img
9+
src="https://www.proangular.com/assets/images/pro-angular-logo-large.png"
10+
/>
911
</a>
1012
<p>
1113
Copyright &copy; Pro Angular 2022

src/app/layout/header.component.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ import { Component } from '@angular/core';
66
<mat-toolbar class="mat-elevation-z6">
77
<mat-toolbar-row>
88
<a class="logo" href="https://www.ProAngular.com" target="_blank">
9-
<img src="assets/images/pro-angular-logo-full.png" />
9+
<img
10+
src="https://www.proangular.com/assets/images/pro-angular-logo-full.png"
11+
/>
1012
</a>
1113
<div class="github-link-container">
1214
<a
1315
href="https://github.com/ProAngular/ngx-gist"
1416
aria-label="GitHub Repo"
1517
target="_blank"
1618
>
17-
<img class="git-hub" src="assets/images/git-hub.svg" />
19+
<img
20+
class="git-hub"
21+
src="https://www.proangular.com/assets/images/git-hub.svg"
22+
/>
1823
</a>
1924
</div>
2025
</mat-toolbar-row>

src/app/public/ngx-gist.component.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import {
4444
target="_blank"
4545
[href]="'https://gist.github.com/' + gid"
4646
>
47-
<mat-icon>link</mat-icon> Open Gist on GitHub
47+
🔗 Open Gist on GitHub
4848
</a>
4949
</mat-card-footer>
5050
@@ -113,12 +113,12 @@ export class NgxGistComponent implements OnInit {
113113
/**
114114
* The `highlight.js` code theme to use and display.
115115
*
116-
* Default: `'default'`
116+
* Default: `undefined`
117117
*
118118
* Note: Only _one_ theme can be loaded on a single page at a time! The first
119119
* theme to load will apply to all gists on the page.
120120
*/
121-
@Input() public codeTheme: HighlightJsTheme = 'default';
121+
@Input() public codeTheme?: HighlightJsTheme;
122122
/**
123123
* Define a material core theme to apply. Ideally, you should already have
124124
* your global material theme set at the root of your project so try to

src/app/public/ngx-gist.module.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@ import { NgxGistService } from './ngx-gist.service';
55
import { MatCardModule } from '@angular/material/card';
66
import { MatTabsModule } from '@angular/material/tabs';
77
import { GistFileFilterPipe } from './ngx-gist-file-filter.pipe';
8-
import { MatIconModule } from '@angular/material/icon';
98
import { NgxGistLineNumbersService } from './ngx-gist-line-numbers.service';
109
import { NgxGistThemeService } from './ngx-gist-theme.service';
1110

1211
@NgModule({
1312
declarations: [NgxGistComponent, GistFileFilterPipe],
1413
imports: [
15-
// Needs to be imported at root.
14+
// Needs to be imported at root. See `README.md` for more info.
1615
// BrowserAnimationsModule,
17-
CommonModule,
18-
// Needs to be imported at root.
1916
// HttpClientModule,
17+
CommonModule,
2018
MatCardModule,
21-
MatIconModule,
2219
MatTabsModule,
2320
],
2421
exports: [NgxGistComponent],

src/styles.scss

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// It's wise to import a prebuilt Material theme or custom theme at the root of
44
// your project when using `@proangular/ngx-gist`.
55

6-
@import "~@angular/material/prebuilt-themes/deeppurple-amber.css";
6+
@import "@angular/material/prebuilt-themes/deeppurple-amber.css";
77

88
/* Alternative pre-built themes.
99
@import "~@angular/material/prebuilt-themes/deeppurple-amber.css";
@@ -18,4 +18,5 @@ body {
1818
background-color: #faf9f6;
1919
}
2020

21-
@import "~highlight.js/styles/github.css";
21+
// Use this to apply a `highlight.js` theme globally
22+
// @import "highlight.js/styles/github.css";

0 commit comments

Comments
 (0)