The library is created for using Github gists and Gitlab snippets in your React application.
Installation can be done with npm
npm install --save react-gistlab
yarn add react-gistlab
import * as React from "react";import GithubGist from "react-gistlab";import s from "./CodeSnippet.scss";const CodeSnippet =<div =><GithubGist=""=/></div>;
⚠️⚠️⚠️ WARNING ⚠️⚠️⚠️
Be careful in using it in production!
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. In order to be safe from XSS, you will need to have your own proxy!
import * as React from "react";import GitlabSnippet from "react-gistlab";import s from "./CodeSnippet.scss";const CodeSnippet =<div =><GitlabSnippet=""=="?"/></div>;
- Add tests
- Set up CI/CD
Contributors are welcome. Please discuss new features and submit PRs for bug fixes with tests.
npm run build which detects type errors, tests passing status and build the lib if everything is well.