(turndownService)
| 4 | var highlightRegExp = /highlight-(?:text|source)-([a-z0-9]+)/; |
| 5 | |
| 6 | function highlightedCodeBlock (turndownService) { |
| 7 | turndownService.addRule('highlightedCodeBlock', { |
| 8 | filter: function (node) { |
| 9 | var firstChild = node.firstChild; |
| 10 | return ( |
| 11 | node.nodeName === 'DIV' && |
| 12 | highlightRegExp.test(node.className) && |
| 13 | firstChild && |
| 14 | firstChild.nodeName === 'PRE' |
| 15 | ) |
| 16 | }, |
| 17 | replacement: function (content, node, options) { |
| 18 | var className = node.className || ''; |
| 19 | var language = (className.match(highlightRegExp) || [null, ''])[1]; |
| 20 | |
| 21 | return ( |
| 22 | '\n\n' + options.fence + language + '\n' + |
| 23 | node.firstChild.textContent + |
| 24 | '\n' + options.fence + '\n\n' |
| 25 | ) |
| 26 | } |
| 27 | }); |
| 28 | } |
| 29 | |
| 30 | function strikethrough (turndownService) { |
| 31 | turndownService.addRule('strikethrough', { |
nothing calls this directly
no outgoing calls
no test coverage detected