diff --git a/README.md b/README.md index e7a5e307..0436bd34 100644 --- a/README.md +++ b/README.md @@ -616,6 +616,8 @@ All options should go under the `Twitch` namespace. | name | Type | Required | Default | Description | | ------ | --------------------- | -------- | ------- | ----------------------------------------------------------------------------------------------------- | | parent | `string` / `string[]` | ✅ | | Domain(s) that will be embedding Twitch. You must have one parent key for each domain your site uses. | +| height | `string` | | 300 | The height of the containing iframe | +| width | `string` | | 100% | The width of the containing iframe | ##### parent diff --git a/src/__tests__/transformers/Twitch.js b/src/__tests__/transformers/Twitch.js index 97d572cc..73d3b387 100644 --- a/src/__tests__/transformers/Twitch.js +++ b/src/__tests__/transformers/Twitch.js @@ -205,6 +205,18 @@ test('Gets the correct Twitch iframe', () => { ); }); +test('Gets the correct Twitch iframe with custom dimensions', () => { + const html = getHTML('https://twitch.tv/videos/546761743', { + parent: 'embed.example.com', + width: '50%', + height: '50%', + }); + + expect(html).toMatchInlineSnapshot( + `` + ); +}); + test('Plugin can transform Twitch links', async () => { const markdownAST = getMarkdownASTForFile('Twitch'); diff --git a/src/transformers/Twitch.js b/src/transformers/Twitch.js index 81414962..d8220248 100644 --- a/src/transformers/Twitch.js +++ b/src/transformers/Twitch.js @@ -91,12 +91,12 @@ export const normalizeParent = (parent) => { return parent; }; -export const getHTML = (url, { parent }) => { +export const getHTML = (url, { parent, width = '100%', height = '300' }) => { const iframeUrl = `${getTwitchIFrameSrc(url)}&parent=${normalizeParent( parent )}`; - return ``; + return ``; }; export const name = 'Twitch';