Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teimurjan/react-gistlab
React components to render GitHub gists and GitLab snippets
https://github.com/teimurjan/react-gistlab
gist gitlab javascript reactjs snippet
Last synced: 8 days ago
JSON representation
React components to render GitHub gists and GitLab snippets
- Host: GitHub
- URL: https://github.com/teimurjan/react-gistlab
- Owner: teimurjan
- License: mit
- Created: 2019-03-29T10:07:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:09:51.000Z (about 2 years ago)
- Last Synced: 2024-12-29T21:37:56.791Z (about 1 month ago)
- Topics: gist, gitlab, javascript, reactjs, snippet
- Language: JavaScript
- Size: 1.85 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 35
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![GitHub license](https://img.shields.io/github/license/teimurjan/sync-query-redux.svg)](https://github.com/teimurjan/react-gistlab/blob/master/LICENSE.md)
[![npm](https://img.shields.io/npm/v/react-gistlab.svg)](https://www.npmjs.com/package/react-gistlab)
![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/react-gistlab.svg)[![Build Status](https://travis-ci.org/teimurjan/react-gistlab.svg?branch=master)](https://travis-ci.org/teimurjan/react-gistlab)
[![codecov](https://codecov.io/gh/teimurjan/react-gistlab/branch/master/graph/badge.svg)](https://codecov.io/gh/teimurjan/react-gistlab)The library is created for using Github gists and Gitlab snippets in your React application.
## Installation
Installation can be done with [npm](https://www.npmjs.com/)
```sh
npm install --save react-gistlab
```or [yarn](https://yarnpkg.com/en/)
```sh
yarn add react-gistlab
```## Usage
### Github gists
```jsx
import * as React from "react";import { GithubGist } from "react-gistlab";
import s from "./CodeSnippet.scss";
const CodeSnippet = () => (
LOADING!
}
/>
);
```### Gitlab snippet
### ⚠️⚠️⚠️ **WARNING** ⚠️⚠️⚠️
Be careful in using it in production!
[Gitlab](http://gitlab.com/) uses `document.write` in their snippets, that's why the snippet not working directly in SPAs. Fetching their snippet directly is blocked by CORS. That's why you should use a disable cors proxy for fetching the snippet. By default it's [cors.io](https://cors.io/?). In order to be safe from XSS, you will need to have your own proxy!
```jsx
import * as React from "react";import { GitlabSnippet } from "react-gistlab";
import s from "./CodeSnippet.scss";
const CodeSnippet = () => (
LOADING!
}
corsProxyURL="https://your.own.proxy/?"
/>
);
```## Plans
- [x] Add tests
- [x] Set up CI/CD## Contributions
Contributors are welcome. Please discuss new features and submit PRs for bug fixes with tests.
Run `npm run build` which detects type errors, tests passing status and build the lib if everything is well.## License
[MIT](./blob/master/LICENSE.md)