Stackedit/public/res/extensions/emailConverter.js
Ammar Alakkad 83b3ef367f Fix typo
2014-09-19 10:35:15 +03:00

18 lines
658 B
JavaScript

define([
"classes/Extension",
], function(Extension) {
var emailConverter = new Extension("emailConverter", "Markdown Email", true);
emailConverter.settingsBlock = '<p>Converts email addresses in the form &lt;email@example.com&gt; into clickable links.</p>';
emailConverter.onPagedownConfigure = function(editor) {
editor.getConverter().hooks.chain("postConversion", function(text) {
return text.replace(/<(mailto\:)?([^\s>]+@[^\s>]+\.\S+?)>/g, function(match, mailto, email) {
return '<a href="mailto:' + email + '">' + email + '</a>';
});
});
};
return emailConverter;
});