.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / remark-stringify / lib / visitors / definition.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/remark-stringify/lib/visitors/definition.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/remark-stringify/lib/visitors/definition.js
new file mode 100644 (file)
index 0000000..0fc8555
--- /dev/null
@@ -0,0 +1,23 @@
+'use strict';
+
+var uri = require('../util/enclose-uri');
+var title = require('../util/enclose-title');
+
+module.exports = definition;
+
+/* Stringify an URL definition.
+ *
+ * Is smart about enclosing `url` (see `encloseURI()`) and
+ * `title` (see `encloseTitle()`).
+ *
+ *    [foo]: <foo at bar dot com> 'An "example" e-mail'
+ */
+function definition(node) {
+  var content = uri(node.url);
+
+  if (node.title) {
+    content += ' ' + title(node.title);
+  }
+
+  return '[' + node.identifier + ']: ' + content;
+}