@@ -44,28 +44,49 @@ empty lines) and replace it with the proper embed-code.
4444<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4545<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
4646
47+ - [ The problem] ( #the-problem )
48+ - [ This solution] ( #this-solution )
49+ - [ Table of Contents] ( #table-of-contents )
4750- [ Installation] ( #installation )
4851- [ Usage] ( #usage )
4952- [ Supported services] ( #supported-services )
5053 - [ CodePen] ( #codepen )
54+ - [ Usage] ( #usage-1 )
5155 - [ CodeSandbox] ( #codesandbox )
56+ - [ Usage] ( #usage-2 )
5257 - [ GIPHY] ( #giphy )
58+ - [ Usage] ( #usage-3 )
5359 - [ Instagram] ( #instagram )
60+ - [ Usage] ( #usage-4 )
5461 - [ Lichess] ( #lichess )
62+ - [ Usage] ( #usage-5 )
5563 - [ Pinterest] ( #pinterest )
64+ - [ Usage] ( #usage-6 )
5665 - [ Slides] ( #slides )
66+ - [ Usage] ( #usage-7 )
5767 - [ SoundCloud] ( #soundcloud )
68+ - [ Usage] ( #usage-8 )
5869 - [ Spotify] ( #spotify )
70+ - [ Usage] ( #usage-9 )
5971 - [ Streamable] ( #streamable )
72+ - [ Usage] ( #usage-10 )
6073 - [ Twitch] ( #twitch )
74+ - [ Usage] ( #usage-11 )
75+ - [ Options] ( #options )
76+ - [ parent] ( #parent )
77+ - [ Netlify] ( #netlify )
78+ - [ Vercel] ( #vercel )
6179 - [ Twitter] ( #twitter )
80+ - [ Usage] ( #usage-12 )
6281 - [ YouTube] ( #youtube )
82+ - [ Usage] ( #usage-13 )
6383- [ Options] ( #options-1 )
6484 - [ customTransformers] ( #customtransformers )
6585 - [ Properties] ( #properties )
6686 - [ ` getHTML(url, options) ` ] ( #gethtmlurl-options )
6787 - [ ` name ` ] ( #name )
6888 - [ ` shouldTransform(url) ` ] ( #shouldtransformurl )
89+ - [ ` defaultOptions ` ] ( #defaultoptions )
6990 - [ Example transformer] ( #example-transformer )
7091 - [ services] ( #services )
7192- [ Inspiration] ( #inspiration )
@@ -744,18 +765,27 @@ as the second argument to [`getHTML`](#gethtmlurl-options).
744765The ` shouldTransform ` method should check if the given URL matches the one
745766intended to transform. It should return a boolean value.
746767
768+ ##### ` defaultOptions `
769+
770+ The ` defaultOptions ` is the value that will be merged with provided options and
771+ passed to [ ` getHTML ` ] ( #gethtmlurl-options ) as a second argument.
772+
747773#### Example transformer
748774
749775``` js
750776// some-site-transformer.js
751- const getHTML = (url ) => ` <iframe src="${ url} "></iframe>` ;
777+ const getHTML = (url , options ) =>
778+ ` <iframe src="${ url} " style="width${ width} "></iframe>` ;
752779
753780const name = ' someSite' ;
754781
755782const regex = / ^ https? :\/\/ some-site\. com\/ / ;
783+
756784const shouldTransform = (url ) => regex .test (url);
757785
758- module .exports = { getHTML, name, shouldTransform };
786+ const defaultOptions = { width: ' 100%' };
787+
788+ module .exports = { getHTML, name, shouldTransform, defaultOptions };
759789```
760790
761791### services
0 commit comments