The Wayback Machine - https://web.archive.org/web/20201130093503/https://github.com/laurent22/joplin/issues/2706
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Markdown-it plugin to support embedded videos #2706

Open
laurent22 opened this issue Mar 9, 2020 · 10 comments
Open

Create a Markdown-it plugin to support embedded videos #2706

laurent22 opened this issue Mar 9, 2020 · 10 comments

Comments

@laurent22
Copy link
Owner

@laurent22 laurent22 commented Mar 9, 2020

Videos would be embedded like so:

[My YouTube video](https://www.youtube.com/watch?v=StTqXEQ2l-Y)

So it is valid Markdown that works as a simple link by default.

However, when the plugin is enabled, it would parse the Markdown links in the page and, when it is a video, display a video player. For now, we only need to support YouTube, but the code should be generic enough to add more video platforms later on.

@jerrybuks
Copy link

@jerrybuks jerrybuks commented Mar 9, 2020

@laurent22 I want to work on this, but it seems to be a plugin that already does this, here is it okay to just integrate it into the codebase?

@laurent22
Copy link
Owner Author

@laurent22 laurent22 commented Mar 9, 2020

I saw it but it's not good because it unecessarily introduces non standard markup. Perhaps it can be used as a starting point to generate the html markup.

@jerrybuks
Copy link

@jerrybuks jerrybuks commented Mar 9, 2020

okay, so you basically want the same functionality replicated, but should generate standard markup(semantic HTML)?

@laurent22
Copy link
Owner Author

@laurent22 laurent22 commented Mar 9, 2020

No I mean the input Markdown should be standard. The output HTML I don't mind so much as long as it's reasonably clean.

Their Markdown looks like this:

@[youtube](dQw4w9WgXcQ)

But that's not good as it's not standard and, if the plugin is not enabled, it won't work at all. So our Markdown should look like this:

[youtube](https://www.youtube.com/watch?v=dQw4w9WgXcQ)

which is standard. It's actually even easier to implement since markdown-it already parses this by default. You'll need to hook into link_open I think.

@jerrybuks
Copy link

@jerrybuks jerrybuks commented Mar 9, 2020

No I mean the input Markdown should be standard. The output HTML I don't mind so much as long as it's reasonably clean.

Their Markdown looks like this:

@[youtube](dQw4w9WgXcQ)

But that's not good as it's not standard and, if the plugin is not enabled, it won't work at all. So our Markdown should look like this:

[youtube](https://www.youtube.com/watch?v=dQw4w9WgXcQ)

which is standard. It's actually even easier to implement since markdown-it already parses this by default. You'll need to hook into link_open I think.

okay, I will give this a try

@Rahul-Shaikh
Copy link

@Rahul-Shaikh Rahul-Shaikh commented Mar 11, 2020

No I mean the input Markdown should be standard. The output HTML I don't mind so much as long as it's reasonably clean.

Their Markdown looks like this:

@[youtube](dQw4w9WgXcQ)

But that's not good as it's not standard and, if the plugin is not enabled, it won't work at all. So our Markdown should look like this:

[youtube](https://www.youtube.com/watch?v=dQw4w9WgXcQ)

which is standard. It's actually even easier to implement since markdown-it already parses this by default. You'll need to hook into link_open I think.

Do you mean to install the plugin then open the plugin's source code where the link destination is parsed and then only keep the code with accepts the standard format?

@laurent22
Copy link
Owner Author

@laurent22 laurent22 commented Mar 11, 2020

Do you mean to install the plugin then open the plugin's source code where the link destination is parsed and then only keep the code with accepts the standard format?

I'm not sure what you mean. You're free to start from that existing plugin if you want. But to be honest the bulk of the work will be in detecting and parsing the YouTube URL and this is not in the existing plugin. Maybe start from scratch with a new plugin, and copy/paste the parts of the other plugin that might be useful (in particular the part to render the YouTube HTML code).

@coderrsid
Copy link
Contributor

@coderrsid coderrsid commented Mar 12, 2020

@laurent22 I read the conversation in the @Rishgod 's PR. Can i still work on this issue?

@KoushikSahu
Copy link

@KoushikSahu KoushikSahu commented Aug 29, 2020

Considering the last PR wasn't merged can I work on this issue? If I can then can you give me any clue how I should approach solving this issue?

@Rahul-Shaikh
Copy link

@Rahul-Shaikh Rahul-Shaikh commented Aug 29, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.