.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / remark-stringify / lib / util / enter-link-reference.js
1 'use strict';
2
3 var returner = require('./returner');
4
5 module.exports = enter;
6
7 /* Shortcut and collapsed link references need no escaping
8  * and encoding during the processing of child nodes (it
9  * must be implied from identifier).
10  *
11  * This toggler turns encoding and escaping off for shortcut
12  * and collapsed references.
13  *
14  * Implies `enterLink`.
15  */
16 function enter(compiler, node) {
17   var encode = compiler.encode;
18   var escape = compiler.escape;
19   var exit = compiler.enterLink();
20
21   if (
22     node.referenceType !== 'shortcut' &&
23     node.referenceType !== 'collapsed'
24   ) {
25     return exit;
26   }
27
28   compiler.escape = returner;
29   compiler.encode = returner;
30
31   return function () {
32     compiler.encode = encode;
33     compiler.escape = escape;
34     exit();
35   };
36 }