3 var streak = require('longest-streak');
4 var repeat = require('repeat-string');
6 module.exports = inlineCode;
8 /* Stringify inline code.
10 * Knows about internal ticks (`\``), and ensures one more
11 * tick is used to enclose the inline code:
13 * ```foo ``bar`` baz```
15 * Even knows about inital and final ticks:
20 function inlineCode(node) {
21 var value = node.value;
22 var ticks = repeat('`', streak(value, '`') + 1);
26 if (value.charAt(0) === '`') {
30 if (value.charAt(value.length - 1) === '`') {
34 return start + value + end;