Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 1.01 KB

README.md

File metadata and controls

35 lines (23 loc) · 1.01 KB

Github gist sample plugin for react-tiny-oembed without proxy server.

Installation

npm install oembed-github-gist

Usage

import Embed, { defaultProviders } from 'react-tiny-oembed'
import gist from 'oembed-github-gist'

function App() {
...

    <Embed
        url="https://gist.github.com/gfx/7a35efaca5e6b40a8b4f888b7f36a5d1"
        proxy="http://cors-anywhere.herokuapp.com/"
        providers={[...defaultProviders, gist]}
    />
}

Options

Nohing much, but you gotta provide height in Embed options, otherwise it straight out uses maxheight from same options as height, which works for most cases though.

About

This is basically a dirty little hack to get github gist urls running with react-tiny-oembed without need for a oembed wrapper proxy server.

It uses requestInterceptor and responceInterceptor in Provider object to do some hacks so as to convert request and responce into the format Embed component can undestand.