Code Monkey home page Code Monkey logo

Comments (4)

fsgreco avatar fsgreco commented on May 16, 2024 1

you can try gatsby-remark-responsive-iframe, it worked for me very well, although it generates some problems with my old posts (they have plenty of html code inside md files so there was some conflicts I didn't have the time to check).

an alternative - that's the one I'm using right now - is to insert a global css media query:

@media (max-width: 550px) {
	.twitter-tweet {max-width: 300px !important;}
	iframe { width: 300px; }
}

It is not elegant but it works well...

from gatsby-remark-oembed.

johnnybenson avatar johnnybenson commented on May 16, 2024 1

Just sketching an idea, it would awesome if the plugin took a container component in config options that wrapped embeds like Layout wraps pages like this:

<!-- page.md -->

`video: https://www.youtube.com/watch?v=k5veb0wZas0`
// gatsby-config.js

  plugins: [
    {
      resolve: `gatsby-transformer-remark`,
      options: {
        plugins: [
          {
            resolve: `@raae/gatsby-remark-oembed`,
            options: {
              container: require.resolve(
                `${__dirname}/src/components/OEmbedContainer/index.js`
              ),
              // usePrefix defaults to false
              // usePrefix: true is the same as ["oembed"]
              usePrefix: ['oembed', 'video'],
...
// components/OEmbedContainer/index.js

// Ideal
const OEmbedContainer = ({ OEmbed }) => ( <div><OEmbed/></div> );

// Because markdown is text
const OEmbedContainer = ({ embed }) => ( <div  dangerouslySetInnerHTML={{ __html: embed }} /> );

Then we can roll our own responsive containers or whatever else.

from gatsby-remark-oembed.

raae avatar raae commented on May 16, 2024

Did this help @qipoy?

from gatsby-remark-oembed.

raae avatar raae commented on May 16, 2024

I like!

This fall I have time to give oembed some much-needed TLC and will look into this.

from gatsby-remark-oembed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.