| 440 | } |
| 441 | |
| 442 | function indentCodeCompensation(raw, text) { |
| 443 | var matchIndentToCode = raw.match(/^(\s+)(?:```)/); |
| 444 | |
| 445 | if (matchIndentToCode === null) { |
| 446 | return text; |
| 447 | } |
| 448 | |
| 449 | var indentToCode = matchIndentToCode[1]; |
| 450 | return text.split('\n').map(function (node) { |
| 451 | var matchIndentInNode = node.match(/^\s+/); |
| 452 | |
| 453 | if (matchIndentInNode === null) { |
| 454 | return node; |
| 455 | } |
| 456 | |
| 457 | var indentInNode = matchIndentInNode[0]; |
| 458 | |
| 459 | if (indentInNode.length >= indentToCode.length) { |
| 460 | return node.slice(indentToCode.length); |
| 461 | } |
| 462 | |
| 463 | return node; |
| 464 | }).join('\n'); |
| 465 | } |
| 466 | /** |
| 467 | * Tokenizer |
| 468 | */ |