1.2.5 • Published 2 years ago

ngx-ggist v1.2.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Demo Stackblitz License

Add a GitHub gist to your angular 13 project in an instant.


Table of Contents

Installation

Install with NPM

npm install ngx-ggist

If you get dependency errors, as a temporary solution you can force the installation:

npm install -f ngx-ggist

Usage

Import NgxGgistModule in your app

import { NgxGgistModule } from 'ngx-ggist';

@NgModule({
  imports: [
    NgxGgistModule
  ],
  ...
})
export class AppModule { }

Use Github Gist directive

Place the component anywhere in your template to display the gist.

<ngx-ggist></ngx-ggist>

Custom Properties

When you add the component to your project (as shown above), you will get the Hello world version of it. That's cool but, to show your own gists, you need to provide a couple of options to the component.

You will need just two properties: your user name and the script id: you can get both from the url of the GitHub gist, or when you copy the script for embedding the gist.

Optionally, you could also provide width, height, and a cool feature to highlight lines.

There are more configurations available, optional.

NameTypeDescription
userstringYour GitHub user
scriptIdstringThe script id of your gist, usually the last parameter in the URL. (i.e. 4171e2f2b5ea64bdf974d6d2e5683cce)
widthstringA string to define the width of the gist container; default: 600px (i.e. '100%')
heightstringA string to define the height of the gist container; default: inherit (i.e. '400px')
linesarray of numberAn array of numbers. Each number represents a line in your gist file and that line will be highlighted; none are highlighted by default.(i.e. 1, 2, 3)

More examples

Example below, will display the gist 417...cce, on a 400px height container, highlighting lines 1, 2, 3.

<ngx-ggist
  user="jocelo"
  scriptId="4171e2f2b5ea64bdf974d6d2e5683cce"
  height="400px"
  [lines]="[1,2,3]" >
</ngx-ggist>

Author

Alfredo Alonso

1.2.0

2 years ago

1.1.0

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.1.14

2 years ago

0.1.13

2 years ago

0.1.12

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago