Comments (4)
Hi @lekterable!
Thanks for reporting this.
Can you provide me with a reproduction link (CodeSandbox) or repo so I can dig into this further, please? 🤔
from gatsby-remark-embedder.
Hi @lekterable!
If I understand your request correctly, I think this isn't something that can be fixed.
If you look at the AST that's created, you'll see that each link will give you the exact same Node.
This means there's no way to know the difference between all 3 of them.
Since this plugin is looking if there's a link on a single line and it's the only thing on that line before transforming it, I suggest you don't put it on a single line or you put some extra braces (()
) around it.
from gatsby-remark-embedder.
Hey @MichaelDeBoey , sorry I wasn't much help in creating a sandbox for those issues and huge thanks for fixing the first one! I've looked at the AST you've linked and I think I might see a way of tackling this.
Every node has a property position -> start -> column which from what I understand indicates where exactly in the text this given link was found.
"children": [
{
"type": "text",
"value": "https://youtube.com/watch?v=dQw4w9WgXcQ",
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 1,
"column": 40,
"offset": 39
},
"indent": []
}
}
],
If that's true we could make sure that the plugin only cares about those links that have this property equal to 1
as it would rule out both this:
<https://www.youtube.com/watch?v=dQw4w9WgXcQ>
and
[https://www.youtube.com/watch?v=dQw4w9WgXcQ](https://www.youtube.com/watch?v=dQw4w9WgXcQ)
because for them it will always be 2
:
"children": [
{
"type": "text",
"value": "https://youtube.com/watch?v=dQw4w9WgXcQ",
"position": {
"start": {
"line": 3,
"column": 2,
"offset": 42
},
"end": {
"line": 3,
"column": 41,
"offset": 81
},
"indent": []
}
}
],
Let me know if that makes sense and if that's the direction you would like to go, if so I'd love to work on a PR for it :)
from gatsby-remark-embedder.
@lekterable That would indeed be a possible solution for what you're suggesting.
Since using pure markdown those 3 lines are seen as exactly the same (people expect them to give the same output), I'm not going to do anything about this.
I hope you understand my point of view and why I'm not going to include your proposal into the plugin.
If you have some future improvements, I'm happy to look into them tho! 🙂
from gatsby-remark-embedder.
Related Issues (20)
- Add responsive option
- Twitch transformer will not work after new Twitch requirements HOT 6
- Twitter embed creates blockquote inside p HOT 8
- Support embed outside gatsby using remark plugins HOT 9
- Support Airtable
- Support TikTok
- Support Simplecast HOT 6
- Support Strava HOT 1
- How to turn off caption of Instagram embeds ? HOT 1
- How to change height and width of Spotify and YouTube ? HOT 2
- Instagram returns 400 response about deprecated oEmbed endpoint HOT 6
- Support Tidal HOT 2
- IG embed fails on private post URL (public posts which were made private later on) HOT 1
- Broken Instagram Embeds - failed oembed api call HOT 3
- Feature request: Support for `loading="lazy"` for iframes HOT 3
- Support Gatsby v3 HOT 2
- Support high performance YouTube and Twitter embeds HOT 2
- Support Gatsby v4 HOT 2
- The plugin doesn't work for Gatsby 4 HOT 16
- Support Gatsby v5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-remark-embedder.