Skip to content

Support for YouTube embed flags #33

Open
@chris13524

Description

@chris13524

In the README, it says the plugins supports various URL forms, such as "XKFDS?rel=0". However, the plugin ignores these flags when it generates the iframe embed.

I suggest there be some mechanism to use these flags. Directly in the URL would probably be the easiest as it would "only" involve modifying the regex to include these flags in the URL.

@[youtube](https://www.youtube.com/embed/KMU0tzLwhbE?rel=0)
@[youtube](KMU0tzLwhbE?rel=0)
@[youtube](<iframe width="560" height="315" src="https://www.youtube.com/embed/KMU0tzLwhbE?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>)

Another possibility would be to put the flags inside the square brackets. This would be much more readable than the first option, but wouldn't allow directly pasting the embed code.

@[youtube:nosuggest](KMU0tzLwhbE)

A third choice would be to add an entry in the options to modify this behavior globally. But this of course prevents modification of the flags on a case-by-case basis.

var md = require('markdown-it')({
  html: true,
  linkify: true,
  typography: true
}).use(require('markdown-it-video', { // <-- this use(package_name) is required
  youtube: { width: 640, height: 390, suggest: false },
}));

I think the best way would be to support all 3! With the precedence [options](..) -> [..](..?options) -> global

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions