KyleMit / eleventy-plugin-embed-tweet

A plugin for embedding tweets on the server side during build time
https://www.npmjs.com/package/eleventy-plugin-embed-tweet
25 stars 4 forks source link

autoEmbed in Markdown problem? #7

Closed huphtur closed 4 years ago

huphtur commented 4 years ago

Not sure if bug or not, but URLs in my markdown do not automatically get linkified, so in order for autoEmbed to work in Markdown, I have to make the URL a hyperlink.

So instead of this: https://twitter.com/KyleMitBTV/status/1211079569245114371

I have to do this: <https://twitter.com/KyleMitBTV/status/1211079569245114371>

and then the plugin produces the publish.twitter.com embed.

Is it possible to pass some settings to this embed? Theme, language, limit context, and Do Not Track (see customization options).

nhoizey commented 4 years ago

@huphtur this is strange. Do you have a full Markdown content example to show, that doesn't work without the < and >?

Can you open a second issue for the settings part, so that it's easier to follow each topic? Thanks.

huphtur commented 4 years ago

@nhoizey check it out: https://github.com/huphtur/eleventy-base-blog/commit/c2ca282c196feebd92ed34683905b71b805d79dd

nhoizey commented 4 years ago

@huphtur ok, this is because you set linkify: false in Markdown, and the code looks for a link.

huphtur commented 4 years ago

Linkify was disabled to make sure line 10 doesn't turn into a link to demonstrate my example that dropping the Twitter URL in a markdown file does not work. Here's a branch without markdownit options, same problem. Line 10 doesn't turn into embed.

Just tried adding a twitter URL on the eleventy-plugin-embed-tweet-demo package and same problem. So looks like I understood the docs wrong?

Suggest changing:

In the source Markdown, it only needs the tweet URL on one single line:

https://twitter.com/KyleMitBTV/status/1211079569245114371

to:

In the source Markdown, it only needs the tweet URL on one single line:

<https://twitter.com/KyleMitBTV/status/1211079569245114371>

This way the plugin will look for a link and embed the tweet.

Let me know if that makes sense, and I'll fire of a PR for the doc change.

nhoizey commented 4 years ago

Linkify was disabled to make sure line 10 doesn't turn into a link to demonstrate my example that dropping the Twitter URL in a markdown file does not work

The plugin currently works by identifying a link to a tweet with the tweet URL as the content. So yes, if you remove link automation, you need to make it a link yourself.

I'll make a PR to also look for a tweet URL in a paragraph, without any link.

nhoizey commented 4 years ago

@huphtur can you try #9 to see if it fixes your issue?

huphtur commented 4 years ago

Confirmed. Working 100%.