Skip to content

Instantly share code, notes, and snippets.

@pdeschen
Last active August 29, 2015 14:20
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 pdeschen/871c7a20c6a29a08a6b3 to your computer and use it in GitHub Desktop.
Save pdeschen/871c7a20c6a29a08a6b3 to your computer and use it in GitHub Desktop.
map extension
// http://stackoverflow.com/questions/164979/uk-postcode-regex-comprehensive
(function(){
var maps = function(converter) {
return [ {
type: 'lang',
filter: function(text) {
return text.replace(/\[map (GIR 0AA|[A-PR-UWYZ]([A-HK-Y]([0-9][A-Z]?|[1-9][0-9])|[1-9]([0-9]|[A-HJKPSTUW])?) ?[0-9][ABD-HJLNP-UW-Z]{2})\]/ig, 'map');
}
}];
};
// Client-side export
if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { window.Showdown.extensions.maps = maps; }
// Server-side export
if (typeof module !== 'undefined') module.exports = maps;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment