-
-
`,
- styles: [],
+ styles: [
+ `
+ h2 {
+ margin-top: 2rem;
+ }
+ h3 {
+ margin-bottom: 3rem;
+ }
+ `,
+ ],
})
-export class AppComponent {}
+export class AppComponent {
+ public readonly localGistObject = NgxGist.create({
+ // Required
+ files: [
+ {
+ content: getTimeSnippet,
+ filename: 'get-time.ts',
+ },
+ {
+ content: printHelloWorldSnippet,
+ filename: 'print-hello-world.js',
+ },
+ ],
+ // Optional
+ created_at: undefined,
+ languageOverride: undefined,
+ });
+}
+
+const getTimeSnippet = `
+function getTime(): number {
+ return new Date().getTime();
+}
+`.trimStart();
+
+const printHelloWorldSnippet = `
+function printHelloWorld() {
+ console.log('Hello world!');
+}
+`.trimStart();
diff --git a/src/app/public/ngx-gist-file-filter.pipe.ts b/src/app/public/ngx-gist-file-filter.pipe.ts
index a4b6637..7efa9a4 100644
--- a/src/app/public/ngx-gist-file-filter.pipe.ts
+++ b/src/app/public/ngx-gist-file-filter.pipe.ts
@@ -13,6 +13,8 @@ export class GistFileFilterPipe implements PipeTransform {
return [];
}
+ console.log(displayOnlyFileNames);
+
if (!displayOnlyFileNames || displayOnlyFileNames === '') {
return files;
}
diff --git a/src/app/public/ngx-gist.component.ts b/src/app/public/ngx-gist.component.ts
index 2b54137..32dbe05 100644
--- a/src/app/public/ngx-gist.component.ts
+++ b/src/app/public/ngx-gist.component.ts
@@ -16,7 +16,7 @@ import { DOCUMENT } from '@angular/common';
@@ -25,16 +25,18 @@ import { DOCUMENT } from '@angular/common';
-
+
+ link Open Gist on GitHub
- Loading Code Snippet...
+
+ Loading Code Snippet...
`,
styleUrls: ['./ngx-gist.component.scss'],
@@ -50,13 +52,23 @@ export class NgxGistComponent implements OnInit {
private htmlLinkElement: HTMLLinkElement | null = null;
/**
- * Display in the DOM only the selected filename from the gists files array.
- *
- * TODO: Make this possible for string array input.
+ * Display in the DOM only the selected filename(s) from the gists files array.
*
* Default: `undefined`
+ *
+ * Example: `'my-styles.scss'` or `'super-feature.ts'`
+ *
+ * Tip: 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.
+ */
+ @Input() public displayOnlyFileNames?: string | readonly string[];
+ /**
+ * Optionally hide the gist link which opens the gist on GitHub. The gist links
+ * automatically dispaly for remote gists, but can be hidden with this feature.
+ *
+ * Default: `false`
*/
- @Input() public displayOnlyFileName?: string;
+ @Input() public hideGistLink = false;
/**
* Provide a static gist model here directly which will be displayed if
* no `gistId` is provided for remote fetching. Also this model will be
@@ -77,12 +89,13 @@ export class NgxGistComponent implements OnInit {
* URL of the gists you create. For example the id `TH1515th31DT0C0PY` in:
* https://gist.github.com/FakeUserName/TH1515th31DT0C0PY
*
- * Alternatively, provide a value directly in the sibling input `gist`.
+ * Default: `undefined`
+ *
+ * Tip: Alternatively, provide a value directly in the sibling input `gist`.
*/
@Input() public set gistId(value: string) {
this.gistIdSubject.next(value);
}
- // We want reactive behavior for `gistId` so we can update gists asynchronously
private readonly gistIdSubject = new ReplaySubject<
NgxGistComponent['gistId']
>(1);
@@ -91,22 +104,23 @@ export class NgxGistComponent implements OnInit {
* When defined, override automatic language detection [and styling] and
* treat all gists as this lanuage.
*
- * See supported languages here:
- * https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
- *
* Default: `undefined`
+ *
+ * Tip: See supported language strings here:
+ * https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
*/
@Input() public languageName?: Language['name'];
/**
* 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 also loaded from a CDN.
+ * avoid using this if possible.
*
- * See theming Angular Material: https://material.angular.io/guide/theming
- *
- * CDN used: `https://unpkg.com`
+ * Note: These are loaded from the CDN: `https://unpkg.com`
*
* Default: `undefined`
+ *
+ * Tip: See theming Angular Material: https://material.angular.io/guide/theming
+ * if you need help applying a global material theme.
*/
@Input() public materialTheme:
| 'deeppurple-amber'
@@ -117,7 +131,7 @@ export class NgxGistComponent implements OnInit {
/**
* Cache the GitHub gist request in local memory for 24 hours. GitHub has a
* request limit, so this helps in reducing bandwidth. Loads previously
- * fetched gist content from the users machine.
+ * fetched gist content from the users machine on refresh and page re-visits.
*
* Default: `true`
*/
diff --git a/src/app/public/ngx-gist.model.ts b/src/app/public/ngx-gist.model.ts
index f65b7b5..f072d94 100644
--- a/src/app/public/ngx-gist.model.ts
+++ b/src/app/public/ngx-gist.model.ts
@@ -70,9 +70,7 @@ export class NgxGist implements Gist {
/* eslint-enable @typescript-eslint/naming-convention */
/** Additional properties */
- public readonly highlightedFiles: Array<
- io.TypeOf & HighlightedContent
- >;
+ public readonly highlightedFiles: HighlightedFiles;
public readonly languageOverride?: string;
/**
@@ -85,15 +83,32 @@ export class NgxGist implements Gist {
* @returns A 'partial' model in which unnecessary fields are dummny data.
*/
public static create(
- args: Pick &
- Pick,
+ args: { files: Files } & Partial> & // Required // Optional
+ Pick, // Optional
): NgxGist {
+ const files: NgxGist['files'] = args.files.reduce((prev, curr) => {
+ const file: GistFilesContent = {
+ // Passed in values, use these.
+ content: curr.content,
+ filename: curr.filename,
+ // Leave these empty, not needed for a local, static model.
+ language: '',
+ raw_url: '',
+ size: 0,
+ truncated: false,
+ type: '',
+ };
+ return {
+ ...prev,
+ [curr.filename]: file,
+ };
+ }, {});
return new NgxGist({
// Properties with settable values. These are the mimimum values needed
// for displaying non "remote".
- created_at: new Date(args.created_at),
- description: args.description,
- files: args.files,
+ created_at: args.created_at ? new Date(args.created_at) : new Date(),
+ description: args.description ?? '',
+ files,
languageOverride: args.languageOverride,
// Empty properties that aren't needed for displaying non "remote" gists
comments: 0,
@@ -140,6 +155,10 @@ export class NgxGist implements Gist {
}
}
+type Files = Array>;
+
+type HighlightedFiles = Array;
+
interface HighlightedContent {
highlightedContent: string;
}
@@ -208,6 +227,7 @@ const gistFilesContent = io.type({
truncated: io.boolean,
type: io.string,
});
+type GistFilesContent = io.TypeOf;
const gistFilesCodec = io.record(io.string, gistFilesContent);
From 2fc669028984e9ac88d241dce303fb67468438d1 Mon Sep 17 00:00:00 2001
From: Cody Tolene
Date: Fri, 29 Jul 2022 22:10:54 -0500
Subject: [PATCH 03/10] Add line numbers
---
package-lock.json | 15 ++++-
package.json | 1 +
src/app/app.component.ts | 20 ++++++
src/app/public/ngx-gist-file-filter.pipe.ts | 2 -
.../public/ngx-gist-line-numbers.service.ts | 61 +++++++++++++++++++
src/app/public/ngx-gist-theme.service.ts | 37 +++++++++++
src/app/public/ngx-gist.component.ts | 60 ++++++++++++------
src/app/public/ngx-gist.model.ts | 12 +++-
src/app/public/ngx-gist.module.ts | 4 +-
9 files changed, 186 insertions(+), 26 deletions(-)
create mode 100644 src/app/public/ngx-gist-line-numbers.service.ts
create mode 100644 src/app/public/ngx-gist-theme.service.ts
diff --git a/package-lock.json b/package-lock.json
index 96c1246..1cc5c40 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6,7 +6,7 @@
"packages": {
"": {
"name": "@proangular/ngx-gist",
- "version": "1.0.0",
+ "version": "1.0.3",
"hasInstallScript": true,
"license": "MIT",
"devDependencies": {
@@ -63,6 +63,7 @@
"@angular/platform-browser": ">=12 <15",
"@ngneat/until-destroy": "^9.2.1",
"highlight.js": "^11.6.0",
+ "highlightjs-line-numbers.js": "^2.8.0",
"io-ts": "^2.2.17",
"io-ts-types": "^0.5.16"
}
@@ -8054,6 +8055,12 @@
"node": ">=12.0.0"
}
},
+ "node_modules/highlightjs-line-numbers.js": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/highlightjs-line-numbers.js/-/highlightjs-line-numbers.js-2.8.0.tgz",
+ "integrity": "sha512-TEf1gw0c8mb8nan0QwliqS7obT4cpUd9hzsGzsZLweteNnWea/VIqy5/aQqsa5wnz9lnvmtAkS1ZtDTjB/goYQ==",
+ "peer": true
+ },
"node_modules/hosted-git-info": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.0.0.tgz",
@@ -20939,6 +20946,12 @@
"integrity": "sha512-ig1eqDzJaB0pqEvlPVIpSSyMaO92bH1N2rJpLMN/nX396wTpDA4Eq0uK+7I/2XG17pFaaKE0kjV/XPeGt7Evjw==",
"peer": true
},
+ "highlightjs-line-numbers.js": {
+ "version": "2.8.0",
+ "resolved": "https://registry.npmjs.org/highlightjs-line-numbers.js/-/highlightjs-line-numbers.js-2.8.0.tgz",
+ "integrity": "sha512-TEf1gw0c8mb8nan0QwliqS7obT4cpUd9hzsGzsZLweteNnWea/VIqy5/aQqsa5wnz9lnvmtAkS1ZtDTjB/goYQ==",
+ "peer": true
+ },
"hosted-git-info": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.0.0.tgz",
diff --git a/package.json b/package.json
index 857ac77..8ea4629 100644
--- a/package.json
+++ b/package.json
@@ -32,6 +32,7 @@
"@angular/platform-browser": ">=12 <15",
"@ngneat/until-destroy": "^9.2.1",
"highlight.js": "^11.6.0",
+ "highlightjs-line-numbers.js": "^2.8.0",
"io-ts": "^2.2.17",
"io-ts-types": "^0.5.16"
},
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 831cb83..dc144a9 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -14,9 +14,20 @@ import { Component } from '@angular/core';
FETCHED GIST (AUTO CACHED FOR 24 HOURS)
+
+ ngx-gist will fetch the gist once and store it locally for 24 hours. In
+ that timeframe if the user returns or visits another page where this
+ gist was previously loaded, it will reload the content without having to
+ reach out to GitHub again.
+
FETCHED GIST (FORCED NO CACHE)
+
+ Force no cache. This will force ngx-gist to retrieve the content live
+ from GitHub every time this content loads. This is disabled by default,
+ but could be useful if your gists change frequently.
+
+
+
HIDING LINE NUMBERS
+
+ Line numbers are enabled by default, but you can turn them off like so.
+
+
`,
diff --git a/src/app/public/ngx-gist-file-filter.pipe.ts b/src/app/public/ngx-gist-file-filter.pipe.ts
index 7efa9a4..a4b6637 100644
--- a/src/app/public/ngx-gist-file-filter.pipe.ts
+++ b/src/app/public/ngx-gist-file-filter.pipe.ts
@@ -13,8 +13,6 @@ export class GistFileFilterPipe implements PipeTransform {
return [];
}
- console.log(displayOnlyFileNames);
-
if (!displayOnlyFileNames || displayOnlyFileNames === '') {
return files;
}
diff --git a/src/app/public/ngx-gist-line-numbers.service.ts b/src/app/public/ngx-gist-line-numbers.service.ts
new file mode 100644
index 0000000..0eb2453
--- /dev/null
+++ b/src/app/public/ngx-gist-line-numbers.service.ts
@@ -0,0 +1,61 @@
+import { DOCUMENT } from '@angular/common';
+import { Inject, Injectable } from '@angular/core';
+import hljs, { HLJSApi } from 'highlight.js';
+import { filter, map, Observable, firstValueFrom, from } from 'rxjs';
+
+@Injectable({ providedIn: 'root' }) // Must be a singleton
+export class NgxGistLineNumbersService {
+ public constructor(@Inject(DOCUMENT) private readonly document: Document) {}
+ private isLoaded = false;
+
+ public async load(): Promise {
+ if (this.isLoaded) {
+ return;
+ }
+
+ try {
+ if (this.document.defaultView) {
+ // Ensure hljs is available before we load the dependant library
+ // `highlightjs-line-numbers.js` dynamically as a js import.
+ this.document.defaultView.hljs = hljs;
+ } else {
+ throw new Error(
+ `Unable to access default view to apply "highlight.js" package.`,
+ );
+ }
+
+ firstValueFrom(this.loadHljsLineNumbersLibrary()).then(() => {
+ // The library `highlightjs-line-numbers.js` adds new functions to the
+ // `highlight.js` scope on load, so we should now be able to call it
+ // without failure.
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ this.document.defaultView?.hljs?.initLineNumbersOnLoad!();
+ });
+ } catch (e: unknown) {
+ console.log(e);
+ } finally {
+ this.isLoaded = true;
+ }
+ }
+
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ private loadHljsLineNumbersLibrary(): Observable {
+ return from(import('highlightjs-line-numbers.js' as any)).pipe(
+ filter((module: any) => !!module && !!module.default),
+ map((module: any) => module.default),
+ );
+ }
+ /* eslint-enable @typescript-eslint/no-explicit-any */
+}
+
+declare global {
+ interface Window {
+ hljs?: HLJSApi & {
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ initLineNumbersOnLoad?: (options?: any) => void;
+ lineNumbersBlock?: (value: Element, options?: any) => void;
+ lineNumbersValue?: (value: string, options?: any) => string;
+ /* eslint-enable @typescript-eslint/no-explicit-any */
+ };
+ }
+}
diff --git a/src/app/public/ngx-gist-theme.service.ts b/src/app/public/ngx-gist-theme.service.ts
new file mode 100644
index 0000000..3f3b1a3
--- /dev/null
+++ b/src/app/public/ngx-gist-theme.service.ts
@@ -0,0 +1,37 @@
+import { Inject, Injectable } from '@angular/core';
+import { DOCUMENT } from '@angular/common';
+
+@Injectable({ providedIn: 'root' }) // Must be a singleton
+export class NgxGistThemeService {
+ public constructor(@Inject(DOCUMENT) private readonly document: Document) {}
+
+ private importElMaterialTheme: HTMLLinkElement | null = null;
+
+ public setTheme(materialPrebuiltTheme: MaterialPrebuiltTheme): void {
+ const themeId = 'material-theme-import';
+ const currentEl = this.document.getElementById(themeId);
+
+ if (currentEl) {
+ this.document.removeChild(currentEl);
+ }
+
+ if (this.importElMaterialTheme) {
+ this.document.removeChild(this.importElMaterialTheme);
+ }
+
+ this.importElMaterialTheme = this.document.createElement('link');
+ this.importElMaterialTheme.href = `https://unpkg.com/@angular/material@14.1.0/prebuilt-themes/${materialPrebuiltTheme}.css`;
+ this.importElMaterialTheme.media = 'screen,print';
+ this.importElMaterialTheme.rel = 'stylesheet';
+ this.importElMaterialTheme.type = 'text/css';
+ this.importElMaterialTheme.id = themeId;
+
+ this.document.head.appendChild(this.importElMaterialTheme);
+ }
+}
+
+export type MaterialPrebuiltTheme =
+ | 'deeppurple-amber'
+ | 'indigo-pink'
+ | 'pink-bluegrey'
+ | 'purple-green';
diff --git a/src/app/public/ngx-gist.component.ts b/src/app/public/ngx-gist.component.ts
index 32dbe05..0e06e5e 100644
--- a/src/app/public/ngx-gist.component.ts
+++ b/src/app/public/ngx-gist.component.ts
@@ -6,6 +6,12 @@ import { Language } from 'highlight.js';
import { BehaviorSubject, filter, firstValueFrom, ReplaySubject } from 'rxjs';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { DOCUMENT } from '@angular/common';
+import { NgxGistLineNumbersService } from './ngx-gist-line-numbers.service';
+import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
+import {
+ MaterialPrebuiltTheme,
+ NgxGistThemeService,
+} from './ngx-gist-theme.service';
@UntilDestroy()
@Component({
@@ -21,7 +27,13 @@ import { DOCUMENT } from '@angular/common';
[label]="file.filename"
>
-
+
+
+ Error loading code...
+
@@ -43,14 +55,12 @@ import { DOCUMENT } from '@angular/common';
})
export class NgxGistComponent implements OnInit {
public constructor(
- @Inject(DOCUMENT)
- private readonly document: Document,
+ @Inject(DOCUMENT) private readonly document: Document,
+ private readonly domSanitizer: DomSanitizer,
private readonly ngxGistService: NgxGistService,
+ private readonly ngxGistLineNumbersService: NgxGistLineNumbersService,
+ private readonly ngxGistThemeService: NgxGistThemeService,
) {}
-
- public codeSnippet: string | null = null;
- private htmlLinkElement: HTMLLinkElement | null = null;
-
/**
* Display in the DOM only the selected filename(s) from the gists files array.
*
@@ -122,12 +132,13 @@ export class NgxGistComponent implements OnInit {
* Tip: See theming Angular Material: https://material.angular.io/guide/theming
* if you need help applying a global material theme.
*/
- @Input() public materialTheme:
- | 'deeppurple-amber'
- | 'indigo-pink'
- | 'pink-bluegrey'
- | 'purple-green'
- | undefined = undefined;
+ @Input() public materialTheme: MaterialPrebuiltTheme | undefined = undefined;
+ /**
+ * Display or hide the line numbers in your gist code snippets.
+ *
+ * Default: `true`
+ */
+ @Input() public showLineNumbers = true;
/**
* Cache the GitHub gist request in local memory for 24 hours. GitHub has a
* request limit, so this helps in reducing bandwidth. Loads previously
@@ -140,6 +151,10 @@ export class NgxGistComponent implements OnInit {
public async ngOnInit(): Promise {
this.setTheme();
+ if (this.showLineNumbers) {
+ await this.ngxGistLineNumbersService.load();
+ }
+
this.gistIdChanges
.pipe(filter(isNonEmptyValue), untilDestroyed(this))
.subscribe(async (gistId) => {
@@ -174,12 +189,19 @@ export class NgxGistComponent implements OnInit {
if (!this.materialTheme) {
return;
}
+ this.ngxGistThemeService.setTheme(this.materialTheme);
+ }
- this.htmlLinkElement = this.document.createElement('link');
- this.htmlLinkElement.href = `https://unpkg.com/@angular/material@14.1.0/prebuilt-themes/${this.materialTheme}.css`;
- this.htmlLinkElement.media = 'screen,print';
- this.htmlLinkElement.rel = 'stylesheet';
- this.htmlLinkElement.type = 'text/css';
- this.document.head.appendChild(this.htmlLinkElement);
+ public applyLineNumbers(highlightedConent: string): SafeHtml | null {
+ if (
+ this.showLineNumbers &&
+ this.document.defaultView?.hljs &&
+ typeof this.document.defaultView.hljs.lineNumbersValue === 'function'
+ ) {
+ return this.domSanitizer.bypassSecurityTrustHtml(
+ this.document.defaultView.hljs.lineNumbersValue(highlightedConent),
+ );
+ }
+ return highlightedConent;
}
}
diff --git a/src/app/public/ngx-gist.model.ts b/src/app/public/ngx-gist.model.ts
index f072d94..a6033e9 100644
--- a/src/app/public/ngx-gist.model.ts
+++ b/src/app/public/ngx-gist.model.ts
@@ -5,7 +5,7 @@ import {
isNonEmptyString,
parsedJsonFromStringCodec,
} from './ngx-gist.utilities';
-import { default as hljs } from 'highlight.js';
+import hljs from 'highlight.js';
export class NgxGist implements Gist {
public constructor(args: Gist & Pick) {
@@ -167,11 +167,17 @@ function getHighlightedContent(
baseContent: string,
languageOverride?: string,
): string {
+ let highlighted = baseContent;
+
if (languageOverride) {
- return hljs.highlight(baseContent, { language: languageOverride }).value;
+ highlighted = hljs.highlight(baseContent, {
+ language: languageOverride,
+ }).value;
+ } else {
+ highlighted = hljs.highlightAuto(baseContent).value;
}
- return hljs.highlightAuto(baseContent).value;
+ return highlighted;
}
const gitHubUserCodec = io.readonly(
diff --git a/src/app/public/ngx-gist.module.ts b/src/app/public/ngx-gist.module.ts
index 5b61bd3..ee63c07 100644
--- a/src/app/public/ngx-gist.module.ts
+++ b/src/app/public/ngx-gist.module.ts
@@ -6,6 +6,8 @@ import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
import { GistFileFilterPipe } from './ngx-gist-file-filter.pipe';
import { MatIconModule } from '@angular/material/icon';
+import { NgxGistLineNumbersService } from './ngx-gist-line-numbers.service';
+import { NgxGistThemeService } from './ngx-gist-theme.service';
@NgModule({
declarations: [NgxGistComponent, GistFileFilterPipe],
@@ -20,6 +22,6 @@ import { MatIconModule } from '@angular/material/icon';
MatTabsModule,
],
exports: [NgxGistComponent],
- providers: [NgxGistService],
+ providers: [NgxGistLineNumbersService, NgxGistService, NgxGistThemeService],
})
export class NgxGistModule {}
From 81147b3c03e39af6a188ecbe866b6e2306039f52 Mon Sep 17 00:00:00 2001
From: Cody Tolene
Date: Fri, 29 Jul 2022 22:19:21 -0500
Subject: [PATCH 04/10] Tweak line number service
---
src/app/public/ngx-gist-line-numbers.service.ts | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/app/public/ngx-gist-line-numbers.service.ts b/src/app/public/ngx-gist-line-numbers.service.ts
index 0eb2453..1c3835f 100644
--- a/src/app/public/ngx-gist-line-numbers.service.ts
+++ b/src/app/public/ngx-gist-line-numbers.service.ts
@@ -9,7 +9,11 @@ export class NgxGistLineNumbersService {
private isLoaded = false;
public async load(): Promise {
- if (this.isLoaded) {
+ if (
+ this.isLoaded ||
+ typeof this.document.defaultView?.hljs?.initLineNumbersOnLoad ===
+ 'function'
+ ) {
return;
}
@@ -24,7 +28,7 @@ export class NgxGistLineNumbersService {
);
}
- firstValueFrom(this.loadHljsLineNumbersLibrary()).then(() => {
+ await firstValueFrom(this.loadHljsLineNumbersLibrary()).then(() => {
// The library `highlightjs-line-numbers.js` adds new functions to the
// `highlight.js` scope on load, so we should now be able to call it
// without failure.
From 7296333c342d3b2b7242d611728c1f9d4f2dec21 Mon Sep 17 00:00:00 2001
From: Cody Tolene
Date: Fri, 29 Jul 2022 22:40:19 -0500
Subject: [PATCH 05/10] Fix up incorrect import on build fail
---
src/app/public/ngx-gist-file-filter.pipe.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/app/public/ngx-gist-file-filter.pipe.ts b/src/app/public/ngx-gist-file-filter.pipe.ts
index a4b6637..a9fe88e 100644
--- a/src/app/public/ngx-gist-file-filter.pipe.ts
+++ b/src/app/public/ngx-gist-file-filter.pipe.ts
@@ -1,7 +1,6 @@
import { NgxGist } from './ngx-gist.model';
import { Pipe, PipeTransform } from '@angular/core';
-import { isStringArray } from './ngx-gist.utilities';
-import { isNonEmptyString } from 'dist/npm';
+import { isNonEmptyString, isStringArray } from './ngx-gist.utilities';
@Pipe({ name: 'gistFileFilter' })
export class GistFileFilterPipe implements PipeTransform {
From 5efa79be46d0be929cb16eaea957980619fd75a8 Mon Sep 17 00:00:00 2001
From: Cody Tolene
Date: Sat, 30 Jul 2022 00:01:13 -0500
Subject: [PATCH 06/10] Update layout and documentation
---
README.md | 147 ++++++++++++++++++++++++++-
src/app/app.component.ts | 6 +-
src/app/app.module.ts | 4 +
src/app/layout/body.component.ts | 1 +
src/app/layout/header.component.ts | 52 ++++++++--
src/app/public/ngx-gist.component.ts | 6 +-
src/assets/images/git-hub.svg | 35 +++++++
src/styles.scss | 1 +
8 files changed, 238 insertions(+), 14 deletions(-)
create mode 100644 src/assets/images/git-hub.svg
diff --git a/README.md b/README.md
index bb2b486..9f06dbd 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
ngx-gist will fetch the gist once and store it locally for 24 hours. In
- that timeframe if the user returns or visits another page where this
+ that timeframe, if the user returns or visits another page where this
gist was previously loaded, it will reload the content without having to
reach out to GitHub again.
@@ -50,8 +50,8 @@ import { Component } from '@angular/core';
DISPLAYING A BASIC CODE SNIPPET (WITHOUT A REMOTE GIST)
These are not fetched from GitHub and are brought in elsewhere from your
- application (seperate HTTP request, or statically for example). With
- this method you can display code snippets without having to create a
+ application (separate HTTP request, or statically, for example). With
+ this method, you can display code snippets without having to create a
remote gist. Also, please notice here that no "Open Gist on GitHub" link
is displayed here.