All Projects → raae → Gatsby Remark Oembed

raae / Gatsby Remark Oembed

Licence: mit
A GatsbyJS Plugin that transforms oembed links into its corresponding embed code.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gatsby Remark Oembed

Mdx Deck
♠️ React MDX-based presentation decks
Stars: ✭ 10,487 (+6709.74%)
Mutual labels:  gatsby, gatsbyjs, markdown
Docs
Repository of Twilio SendGrid's product documentation.
Stars: ✭ 221 (+43.51%)
Mutual labels:  hacktoberfest, gatsby, markdown
Gatsby Remark Embedder
Gatsby Remark plugin to embed well known services by their URL.
Stars: ✭ 245 (+59.09%)
Mutual labels:  soundcloud, gatsby, markdown
Github Profilinator
🚀 This tool contains mini GUI components that you can hook together to automatically generate markdown code for a perfect readme.
Stars: ✭ 225 (+46.1%)
Mutual labels:  hacktoberfest, gatsby, markdown
Gatsby Starter Deck
🗣 Create presentations using Gatsby, React & Markdown.
Stars: ✭ 522 (+238.96%)
Mutual labels:  gatsby, gatsbyjs, markdown
Gatsby Advanced Starter
A high performance skeleton starter for GatsbyJS that focuses on SEO/Social features/development environment.
Stars: ✭ 1,224 (+694.81%)
Mutual labels:  gatsby, gatsbyjs, markdown
Sentry Docs
The new place for the sentry documentation (and tools to build it)
Stars: ✭ 160 (+3.9%)
Mutual labels:  hacktoberfest, gatsby, gatsbyjs
Reactive Resume
A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
Stars: ✭ 3,280 (+2029.87%)
Mutual labels:  hacktoberfest, gatsby, gatsbyjs
Github Profile Readme Generator
🚀 Generate GitHub profile README easily with the latest add-ons like visitors count, GitHub stats, etc using minimal UI.
Stars: ✭ 7,812 (+4972.73%)
Mutual labels:  hacktoberfest, gatsby, markdown
Blog
My blog created with React, Gatsby & Markdown
Stars: ✭ 29 (-81.17%)
Mutual labels:  gatsby, gatsbyjs, markdown
Nodejs.dev
A new Node.js resource built using Gatsby.js with React.js, TypeScript, and Remark.
Stars: ✭ 1,794 (+1064.94%)
Mutual labels:  hacktoberfest, gatsby, gatsbyjs
Gatsby Themes
Gatsby themes that we use to build websites at Rocketseat ⚡️🔥
Stars: ✭ 116 (-24.68%)
Mutual labels:  hacktoberfest, gatsby
Gray Matter
Contributing Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Stars: ✭ 2,105 (+1266.88%)
Mutual labels:  gatsby, markdown
Developer Community Stats
🚀 A repository to encourage beginners to contribute to open source and for all contributors to view their Github stats
Stars: ✭ 116 (-24.68%)
Mutual labels:  hacktoberfest, gatsby
Gatsby Plugin Mailchimp
A simple, lightweight Gatsby plugin to subscribe new email addresses to your Mailchimp list
Stars: ✭ 125 (-18.83%)
Mutual labels:  gatsby, gatsbyjs
Mdx Embed
Embed 3rd party media content in MDX - no import required 🧽
Stars: ✭ 119 (-22.73%)
Mutual labels:  hacktoberfest, gatsby
Torchbear
🔥🐻 The Speakeasy Scripting Engine Which Combines Speed, Safety, and Simplicity
Stars: ✭ 128 (-16.88%)
Mutual labels:  hacktoberfest, markdown
Gatsby Starter Foundation
A starter to launch your blazing fast personal website and a blog, Built with Gatsby and Netlify CMS. Made with ❤ by Stackrole
Stars: ✭ 135 (-12.34%)
Mutual labels:  gatsby, gatsbyjs
Github Action Markdown Link Check
Check all links in markdown files if they are alive or dead. 🔗✔️
Stars: ✭ 132 (-14.29%)
Mutual labels:  hacktoberfest, markdown
Gatsby Source Datocms
Official GatsbyJS source plugin to pull content from DatoCMS
Stars: ✭ 113 (-26.62%)
Mutual labels:  gatsby, gatsbyjs

Gatsby Remark oEmbed Plugin

This GatsbyJS Remark Sub-Plugin transforms oEmbed links (Twitter, Instagram, YouTube, Vimeo, SoundCloud, CodePen etc.) into its corresponding embed code.

This is an early version of the plugin. Let me know if you have problems or questions by submitting an issue.

Install

npm install @raae/gatsby-remark-oembed

or

yarn add @raae/gatsby-remark-oembed

Requirements

  • Node version 8 and up.
  • Gatsby version >=2.0.88
  • Gatsby Transformer Remark Plugin >=2.0.0

oEmbed support

Under the hood the oEmbed provider list from oembed.com is used.

So far these providers are confirmed to be working: CodePen, Flickr, Instagram, Reddit, Twitter, Vimeo, YouTube, SoundCloud.

Twitter, Flickr, Instagram and Reddit requires external javascript to be added to every page. So make sure to exclude the ones you do not need.

Warning: The Instagram oEmbed API requires an access token. You'll need a Facebook Developer account, a Facebook App, and an App Access Token. More information here, or take a look at this tutorial for setting it all up in Gatsby with Environment Variables.

Update: Twitch removed oEmbed support in 2020 when deprecating their v5 API. It seems they are not planning to support oEmbed again. Unfortunately this means Twitch urls are no longer being transformed. Let them know how you feel about this on their forum.

Example site

Check out gatsby-remark-oembed.netlify.com/. Its source code can be found in gatsby-remark-oembed-example-site.

How to use

Configuration

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        {
          resolve: `@raae/gatsby-remark-oembed`,
          options: {
            // usePrefix defaults to false
            // usePrefix: true is the same as ["oembed"]
            usePrefix: ["oembed", "video"],
            providers: {
              // Important to exclude providers
              // that adds js to the page.
              // If you do not need them.
              exclude: ["Reddit"],
            },
          },
        },
      ],
    },
  },
];

Settings per provider

Many oEmbed providers offer additional options for configure the display of the embed.

For example, for Twitter see Embedded Tweet parameter reference, which describes the additional oEmbed parameters you might want to change for the embed.

// …
{
  resolve: `@raae/gatsby-remark-oembed`,
  options: {
    usePrefix: true,
    providers: {
      include: [
        'Twitter',
        'Instagram',
      ],
      settings: {
        // Ex. Show all Twitter embeds with the dark theme, and disables ad tracking
        Twitter: {
          theme: 'dark',
          dnt: true
        },
        // Ex. Hide all Instagram comments by default, and
        // add a facebook access token
        Instagram: {
           hidecaption: true,
           access_token: 'a-facebook-access-token'
        },
      },
    },
  },
}

Content

With setting usePrefix: true

// In your markdown file

Check it out! I can use oembed links in my markdown.

`oembed: https://twitter.com/raae/status/1045394833001652225`

Its pretty cool :D

`oembed: https://www.instagram.com/p/Bof9WhgBmY2/`

Links must be surrounded by empty lines.

With setting usePrefix: array of prefixes

If you would like to use a prefix other than "oembed" or multiple prefixes you can set usePrefix to an array of custom prefixes. This can be beneficial when converting from other embed plugins.

usePrefix: ["embed", "video", "oembed"]

// In your markdown file

Check it out! I can use the prefix "oembed:"

`oembed: https://twitter.com/raae/status/1045394833001652225`

Or I can use the prefix "embed:" if I like ;)

`embed: https://www.instagram.com/p/Bof9WhgBmY2/`

I can also use "video:" like I did before with `gatsby-remark-video`.

`video: https://vimeo.com/42672205`

usePrefix: true in the section above is the same as usePrefix: ["oembed"].

With setting usePrefix: false

// In your markdown file

Check it out! I can use oembed links in my markdown.

https://twitter.com/raae/status/1045394833001652225

Its pretty cool :D

https://www.instagram.com/p/Bof9WhgBmY2/

Links must be surrounded by empty lines.

Options

Name Type Description
usePrefix Boolean / Array of prefixes See above section on content
providers.include Array of provider keys Only links from providers on this list will be transformed.
providers.exclude Array of provider keys Links from providers on this list will not be transformed.
providers.settings Object of provider settings Optional configuration unique to each provider.

Dev routines

This is a monorepo consisting of the plugin, and two example sites:

  • /gatsby-remark-oembed-md-site - the markdown example site
  • /gatsby-remark-oembed-mdx-site - the mdx example site

And the plugin /gatsby-remark-oembed.

By running yarn dev in the monorepo root you will spin up both sites.

Release routines

Make sure you have checked out and updated master.

Change directory to gatsby-remark-oembed.

Buy me a coffee?

It will encourage me to keep it going, fix whatever bugs you find and spend time making it better :D

ko-fi

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].