Skip to content

Instantly share code, notes, and snippets.

@joshuaadickerson
Created August 8, 2015 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshuaadickerson/376d510c9d752e9b290a to your computer and use it in GitHub Desktop.
Save joshuaadickerson/376d510c9d752e9b290a to your computer and use it in GitHub Desktop.
A BBC tag for adding gist snippets
<?php
function gist_bbc(&$codes, &$no_autolink_tags, &$itemcodes)
{
$codes[] = array(
'tag' => 'gist',
'type' => 'unparsed_content',
'content' => '<script src="$1.js"></script>',
'validate' => function(&$tag, &$data, $disabled) {
$data = strtr($data, array('<br />' => ''));
if (strpos($data, 'http://') !== 0 && strpos($data, 'https://') !== 0)
$data = 'https://' . $data;
},
);
$no_autolink_tags[] = 'gist';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment