3 var uri = require('../util/enclose-uri');
4 var title = require('../util/enclose-title');
6 module.exports = image;
10 * Is smart about enclosing `url` (see `encloseURI()`) and
11 * `title` (see `encloseTitle()`).
13 * ![foo](</fav icon.png> 'My "favourite" icon')
15 * Supports named entities in `url`, `alt`, and `title`
16 * when in `settings.encode` mode.
18 function image(node) {
20 var content = uri(self.encode(node.url || '', node));
21 var exit = self.enterLink();
22 var alt = self.encode(self.escape(node.alt || '', node));
27 content += ' ' + title(self.encode(node.title, node));
30 return '![' + alt + '](' + content + ')';