gatsby-remark-embedder - npm explorer


style="background-color: #F4F4F4; border-radius: 50%; flex-grow: 0; height: 20px; width: 20px;"
>

style="width: 0; height: 0; border-top: 2px solid transparent; border-left: 6px solid #f4f4f4; border-bottom: 2px solid transparent; transform: translateX(16px) translateY(-4px) rotate(30deg)"
>


style="width: 0; border-top: 8px solid #F4F4F4; border-right: 8px solid transparent; transform: translateY(16px);"
>

style="background-color: #F4F4F4; flex-grow: 0; height: 12px; width: 16px; transform: translateY(-4px);"
>
style="width: 0; height: 0; border-top: 8px solid #F4F4F4; border-left: 8px solid transparent; transform: translateY(-4px) translateX(8px);"
>
>


href="https://www.instagram.com/p/B60jPE6J8U-/?utm_source=ig_embed&utm_campaign=loading"
style="color:#000; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px; text-decoration:none; word-wrap:break-word;"
target="_blank"
>Good morning New York! πŸ—½ #newyork #nyc #brotrip #newyear #2020 #city
#bluesky #clearsky #timessquare #nycitylife #nycityworld #urban
#manhattan #travel #cold #winter #citytrip #lastday #streetview
#citythatneversleeps #bucketlist #buildings #skyscraper #midtown
>


style="color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; line-height:17px; margin-bottom:0; margin-top:8px; overflow:hidden; padding:8px 0 7px; text-align:center; text-overflow:ellipsis; white-space:nowrap;"
>
A post shared by
href="https://www.instagram.com/michaeldeboey/?utm_source=ig_embed&utm_campaign=loading"
style="color:#c9c8cd; font-family:Arial,sans-serif; font-size:14px; font-style:normal; font-weight:normal; line-height:17px;"
target="_blank"
>
MichaΓ«l De Boey
>
(@michaeldeboey) on
style="font-family:Arial,sans-serif; font-size:14px; line-height:17px;"
datetime="2020-01-02T14:45:30+00:00"
>Jan 2, 2020 at 6:45am PST
>




`

#### Options

All options should go under the Instagram namespace.

| name | Type | Required | Default | Description |
| ----------- | -------- | -------- | ------- | -------------------------------------------------------- |
| accessToken |
string | βœ… | | An App Access Token (recommended) or Client Access Token |

##### accessToken

To get an App Access Token (recommended) or Client Access Token for the
Instagram embed, check out the [Instagram oEmbed access token
docs][instagram-oembed-access-token-docs] and
[requirements][instagram-oembed-requirements-docs].

The safest way to enter your accessToken is to set is as an [environment
variable][gatsby-environment-variables-docs].


Example

`js
const GatsbyRemarkEmbedderOptions = {
services: {
Instagram: {
accessToken: process.env.INSTAGRAM_ACCESS_TOKEN,
},
},
};
`

$3

#### Usage

`md
https://lichess.org/MPJcy1JW
`


Result

`html
src="https://lichess.org/embed/MPJcy1JW"
width="600"
height="397"
frameborder="0"
>
`

$3

The returned HTML snippet from the Pinterest transformer will only be
automatically recognized as an embedded pin when Pinterest's embed JavaScript is
included on the page.
Since the Pinterest transformer doesn't include this JavaScript (because we
don't want to include it multiple times on a page when having multiple embeds),
you have to include it yourself. The recommended way of including it is by using
[
gatsby-plugin-pinterest][gatsby-plugin-pinterest].

#### Usage

`md
https://pinterest.com/pin/99360735500167749
`


Result

`html
data-pin-do="embedPin"
href="https://pinterest.com/pin/99360735500167749"
>
`

$3

#### Usage

`md
https://slides.com/kentcdodds/oss-we-want
`


Result

`html
src="https://slides.com/kentcdodds/oss-we-want/embed"
width="576"
height="420"
scrolling="no"
frameborder="0"
webkitallowfullscreen
mozallowfullscreen
allowfullscreen
>
`

$3

#### Usage

`md
https://soundcloud.com/clemenswenners/africa
`


Result

`html
width="100%"
height="300"
scrolling="no"
frameborder="no"
src=https://w.soundcloud.com/player?url=https://soundcloud.com/clemenswenners/africa&color=ff5500&auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&show_teaser=false&visual=true
>
`

$3

#### Usage

`md
https://open.spotify.com/track/0It2bnTdLl2vyymzOkBI3L
`


Result

`html
src="https://open.spotify.com/embed/track/0It2bnTdLl2vyymzOkBI3L"
width="100%"
height="380"
frameborder="0"
allowtransparency="true"
allow="encrypted-media"
>
`

$3

#### Usage

`md
https://streamable.com/moo
`


Result

`html
class="streamable-embed"
src="https://streamable.com/o/moo"
frameborder="0"
scrolling="no"
width="1920"
height="1080"
allowfullscreen
>
`

$3

#### Usage

`md
https://testing-playground.com/gist/fb336c386145b235372a0f57d5c58205/6d13e4ee508301c8b42f9d2cc8584e70bb05fb4a
`


Result

`html
src="https://testing-playground.com/embed/fb336c386145b235372a0f57d5c58205/6d13e4ee508301c8b42f9d2cc8584e70bb05fb4a?panes=query,preview"
height="450"
width="100%"
scrolling="no"
frameborder="0"
allowTransparency="true"
style="overflow: hidden; display: block; width: 100%"
>
`

$3

Twitch embeds can only be embedded on HTTPS websites. Check out [the Gatsby
docs][gatsby-https-docs] for setting this up when developing locally.

#### Usage

`md
https://twitch.tv/videos/546761743
`


Result

`html
src="https://player.twitch.tv/?video=546761743"
height="300"
width="100%"
frameborder="0"
scrolling="no"
allowfullscreen
>
`

#### Options

All options should go under the Twitch namespace.

| name | Type | Required | Default | Description |
| ------ | --------------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------- |
| parent |
string / string[] | βœ… | | Domain(s) that will be embedding Twitch. You must have one parent key for each domain your site uses. |

##### parent

You could either put in (a) hardcoded value(s) _or_ you could use environment
variables that are available during the build process.

###### Netlify

Netlify has the URL, DEPLOY_URL and DEPLOY_PRIME_URL environment
variables. Take a look at [the Netlify docs][netlify-environment-variables-docs]
for more info.


Example

`js
const GatsbyRemarkEmbedderOptions = {
services: {
Twitch: {
parent: [
process.env.URL,
process.env.DEPLOY_URL,
process.env.DEPLOY_PRIME_URL,

// Other domains here...
],
},
},
};
`

###### Vercel

Vercel has the VERCEL_URL environment variable. Take a look at [the Vercel
docs][vercel-environment-variables-docs] for more info.


Example

`js
const GatsbyRemarkEmbedderOptions = {
services: {
Twitch: {
parent: [
process.env.VERCEL_URL,

// Other domains here...
],
},
},
};
`

$3

The returned HTML snippet from the Twitter transformer will only be
automatically recognized as an [Embedded Tweet][embedded-tweet-docs] when
[Twitter's widget JavaScript][twitter-widget-javascript-docs] is included on the
page.
Since the Twitter transformer doesn't include this JavaScript (because we don't
want to include it multiple times on a page when having multiple embeds), you
have to include it yourself. The recommended way of including it is by using
[
gatsby-plugin-twitter][gatsby-plugin-twitter].

#### Usage

`md
https://twitter.com/MichaelDeBoey93/status/1152991421789548546

https://twitter.com/i/moments/994601867987619840

https://twitter.com/wesbos/timelines/1189618481672667136
`


Result

`html



Happy to announce I just published the first gatsby-remark-embedder πŸŽ‰πŸŽ‰πŸŽ‰




This first version is an extract of
@kentcdodds' personal website
remark-embedder plugin, but I'm planning on adding extra services then
@codesandbox, href="https://twitter.com/Twitter"
>
@Twitter

& @YouTube too.
https://t.co/M4PA9aFZdG


β€” MichaΓ«l De Boey (@MichaelDeBoey93)

July 21, 2019

class="twitter-moment"
href="https://twitter.com/i/moments/994601867987619840"
>
πŸ”₯ Design Tips

class="twitter-timeline"
href="https://twitter.com/wesbos/timelines/1189618481672667136"
>
πŸ”₯ Hot Tips from Wes Bos - Curated tweets by wesbos

`

$3

The YouTube transformer (currently) only supports videos in the following
formats:

- Full url (https://youtube.com/watch?v=dQw4w9WgXcQ)
- Short url (
https://youtu.be/dQw4w9WgXcQ)

#### Usage

`md
https://youtu.be/dQw4w9WgXcQ
`


Result

`html
width="100%"
height="315"
src="https://www.youtube-nocookie.com/embed/dQw4w9WgXcQ?rel=0"
frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
>
`

Options

$3

The plugin allows you to pass an array of custom transformers that will be
executed additionally to the default ones.

#### Properties

Each transformer should be an object which has the following properties:

##### getHTML(url, options)

The getHTML method is executed when the given URL has been matched to
transform. It should return the transformed HTML.
This asynchronous function receives the URL to transform together with an
options object to take into account when transforming.

##### name

The name is the value that needs to be used as a key in the
services plugin option. The value for this key will be provided
as the second argument to
getHTML.

##### shouldTransform(url)

The shouldTransform method should check if the given URL matches the one
intended to transform. It should return a boolean value.

#### Example transformer

`js
// some-site-transformer.js
const getHTML = (url) =>
;

const name = 'someSite';

const regex = /^https?:\/\/some-site\.com\//;
const shouldTransform = (url) => regex.test(url);

module.exports = { getHTML, name, shouldTransform };
``

$3

The plugin also allows you to pass an object which keys that represent the name
of the service to transform and the value that's an
object with options for that specific service.

Inspiration

This whole plugin was extracted out of Kent C. Dodds' [personal
website][kentcdodds.com-repo].

The intention is to make this available to be used independently.

Issues

_Looking to contribute? Look for the [Good First Issue][good-first-issue]
label._

$3

Please file an issue for bugs, missing documentation, or unexpected behavior.

[See Bugs][bugs]

$3

Please file an issue to suggest new features. Vote on feature requests by adding
a πŸ‘. This helps maintainers prioritize what to work on.

[See Feature Requests][requests]

Contributors ✨

Thanks goes to these people ([emoji key][emojis]):





































Kent C. Dodds

πŸ’» πŸ“– πŸ€” πŸš‡ ⚠️

MichaΓ«l De Boey

πŸ› πŸ’» πŸ“– ⚠️

Kornel Dubieniecki

πŸ›

Nick Nish

πŸ’» ⚠️

Caneco

🎨

Anurag Hazra

πŸ› πŸ’» ⚠️ πŸ“–

Yash Joshi

πŸ’» ⚠️

Christian C. SalvadΓ³

πŸ’» ⚠️

James Simone

πŸ’» ⚠️

Agastya Chandrakant

πŸ’» ⚠️

FΓ‘bio Rosado

πŸ’» ⚠️

Arryangga Aliev Pratamaputra

πŸ›

Eduardo Reveles

πŸ’» ⚠️

Michal Piechowiak

πŸ› πŸ’» ⚠️

Brad Garropy

πŸ›

Ilya Lyamkin

πŸ’»

Simon MacDonald

πŸ› πŸ’» ⚠️

Nicky Meuleman

πŸ’»

Ayush

πŸ’»

TEEAARBEE

πŸ›

Trevor Blades

πŸ“–

Titus

⚠️ πŸ‘€ πŸ’»

Joe Previte

πŸ›


This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!

LICENSE

MIT


[npm]: https://www.npmjs.com
[node]: https://nodejs.org
[build-badge]: https://img.shields.io/github/workflow/status/MichaelDeBoey/gatsby-remark-embedder/validate?logo=github&style=flat-square
[build]: https://github.com/MichaelDeBoey/gatsby-remark-embedder/actions?query=workflow%3Avalidate
[coverage-badge]: https://img.shields.io/codecov/c/github/MichaelDeBoey/gatsby-remark-embedder.svg?style=flat-square
[coverage]: https://codecov.io/github/MichaelDeBoey/gatsby-remark-embedder
[version-badge]: https://img.shields.io/npm/v/gatsby-remark-embedder.svg?style=flat-square
[package]: https://www.npmjs.com/package/gatsby-remark-embedder
[downloads-badge]: https://img.shields.io/npm/dm/gatsby-remark-embedder.svg?style=flat-square
[npmtrends]: https://www.npmtrends.com/gatsby-remark-embedder
[license-badge]: https://img.shields.io/npm/l/gatsby-remark-embedder.svg?style=flat-square
[license]: https://github.com/MichaelDeBoey/gatsby-remark-embedder/blob/main/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: https://makeapullrequest.com
[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
[coc]: https://github.com/MichaelDeBoey/gatsby-remark-embedder/blob/main/CODE_OF_CONDUCT.md
[emojis]: https://allcontributors.org/docs/en/emoji-key
[all-contributors]: https://github.com/all-contributors/all-contributors
[all-contributors-badge]: https://img.shields.io/github/all-contributors/MichaelDeBoey/gatsby-remark-embedder?color=orange&style=flat-square
[bugs]: https://github.com/MichaelDeBoey/gatsby-remark-embedder/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Acreated-desc+label%3Abug
[requests]: https://github.com/MichaelDeBoey/gatsby-remark-embedder/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3Aenhancement
[good-first-issue]: https://github.com/MichaelDeBoey/gatsby-remark-embedder/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A%22good+first+issue%22

[codepen]: https://codepen.io
[codesandbox]: https://codesandbox.io
[embedded-tweet-docs]: https://developer.twitter.com/web/embedded-tweets
[gatsby]: https://github.com/gatsbyjs/gatsby
[gatsby-environment-variables-docs]: https://www.gatsbyjs.com/docs/environment-variables
[gatsby-https-docs]: https://gatsbyjs.org/docs/local-https
[gatsby-plugin-instagram-embed]: https://github.com/MichaelDeBoey/gatsby-plugin-instagram-embed
[gatsby-plugin-mdx]: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-mdx
[gatsby-plugin-pinterest]: https://github.com/robinmetral/gatsby-plugin-pinterest
[gatsby-plugin-twitter]: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-twitter
[gatsby-transformer-remark]: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-transformer-remark
[giphy]: https://giphy.com
[instagram]: https://instagram.com
[instagram-oembed-access-token-docs]: https://developers.facebook.com/docs/instagram/oembed#access-tokens
[instagram-oembed-requirements-docs]: https://developers.facebook.com/docs/instagram/oembed#requirements
[kentcdodds.com-repo]: https://github.com/kentcdodds/kentcdodds.com
[lichess]: https://lichess.org
[netlify-environment-variables-docs]: https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata
[pinterest]: https://pinterest.com
[slides]: https://slides.com
[soundcloud]: https://soundcloud.com
[spotify]: https://spotify.com
[streamable]: https://streamable.com
[testing-playground]: https://testing-playground.com
[twitch]: https://twitch.tv
[twitter]: https://twitter.com
[twitter-widget-javascript-docs]: https://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/overview
[vercel-environment-variables-docs]: https://vercel.com/docs/v2/build-step?query=Build#system-environment-variables
[youtube]: https://youtube.com