A few months back we added Embed and oEmbed abilities to snippets saved using our generators and in the past weeks we are seeing a giant increase in the number of sites / users using this service.
This is great, but we’d like the internet to be diverse and not all look the same so we have added a some features to let you customize the embedded snippet look and feel.
In this post we will go over these extra features and how to use them.
If you want to enable all other features describe bellow just add parameters to the embed src URL, We’ll go over that later.
you can change the embedded snippet theme using the
theme parameter using any of these values:
- github (default)
- md (material design)
- luminous_dark (dark theme)
- luminous_light (light theme)
So this is the default theme, GitHub theme:
And if we what to use another theme like the material design (which is the one we use on this blog) we just set the
theme parameter to
md on the embed src url:
Line numbers, Auto links and more…
Line numbers are turned on by default but you can turn it off using the
ln parameter and set it to zero (0).
Other then just turning line numbers on or off you can also control he starting line number which obviously defaults to one, to set the starting line number just use the
sl parameter to the number you want, lets say 15 for example:
You can tell the embedded snippet to auto-link links listed in the code and because this feature is set off by default you can simple turn it on by using the
al parameter and setting it to one (1).
By default the max height for an embedded snippet is set to
500px but you can overwrite that if you have a long snippet and don’t want a vertical scroll bar or a very short snippet, by using the
mh parameter which accepts the max height in pixels (no need for the
px at the end).
Our default syntax language is derived from our generators which is PHP, but we do have a custom snippet generator that accepts other programming languages typed snippets and that’s why we added the
currently accepted languages are:
- php (default)
That’s not good!!! see the automatically added
<?php on the first line?
Now lets set the
The snippet embed code creates a html that shows the snipped on your page by default but if you’d like you can set the
format parameter to iframe and your snippet will be wrapped inside an iframe on your page, super useful when embedding different themes on a single page.
Using GenerateWP oEmbed plugin
If you decide to use the our plugin the you don’t need to use the embed code, you just need the snippet page URL ex:
And if you want to customize it just use any of the parameters described above, for example material design theme with max height of 900px and no line numbers:
That’s is it for now,
we hope you’ll enjoy using these features and feel free to let us know what you think.