to-markdown.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.toMarkdown = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. /*
  3. * to-markdown - an HTML to Markdown converter
  4. *
  5. * Copyright 2011+, Dom Christie
  6. * Licenced under the MIT licence
  7. *
  8. */
  9. 'use strict'
  10. var toMarkdown
  11. var converters
  12. var mdConverters = require('./lib/md-converters')
  13. var gfmConverters = require('./lib/gfm-converters')
  14. var HtmlParser = require('./lib/html-parser')
  15. var collapse = require('collapse-whitespace')
  16. /*
  17. * Utilities
  18. */
  19. var blocks = ['address', 'article', 'aside', 'audio', 'blockquote', 'body',
  20. 'canvas', 'center', 'dd', 'dir', 'div', 'dl', 'dt', 'fieldset', 'figcaption',
  21. 'figure', 'footer', 'form', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
  22. 'header', 'hgroup', 'hr', 'html', 'isindex', 'li', 'main', 'menu', 'nav',
  23. 'noframes', 'noscript', 'ol', 'output', 'p', 'pre', 'section', 'table',
  24. 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul'
  25. ]
  26. function isBlock (node) {
  27. return blocks.indexOf(node.nodeName.toLowerCase()) !== -1
  28. }
  29. var voids = [
  30. 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input',
  31. 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'
  32. ]
  33. function isVoid (node) {
  34. return voids.indexOf(node.nodeName.toLowerCase()) !== -1
  35. }
  36. function htmlToDom (string) {
  37. var tree = new HtmlParser().parseFromString(string, 'text/html')
  38. collapse(tree.documentElement, isBlock)
  39. return tree
  40. }
  41. /*
  42. * Flattens DOM tree into single array
  43. */
  44. function bfsOrder (node) {
  45. var inqueue = [node]
  46. var outqueue = []
  47. var elem
  48. var children
  49. var i
  50. while (inqueue.length > 0) {
  51. elem = inqueue.shift()
  52. outqueue.push(elem)
  53. children = elem.childNodes
  54. for (i = 0; i < children.length; i++) {
  55. if (children[i].nodeType === 1) inqueue.push(children[i])
  56. }
  57. }
  58. outqueue.shift()
  59. return outqueue
  60. }
  61. /*
  62. * Contructs a Markdown string of replacement text for a given node
  63. */
  64. function getContent (node) {
  65. var text = ''
  66. for (var i = 0; i < node.childNodes.length; i++) {
  67. if (node.childNodes[i].nodeType === 1) {
  68. text += node.childNodes[i]._replacement
  69. } else if (node.childNodes[i].nodeType === 3) {
  70. text += node.childNodes[i].data
  71. } else continue
  72. }
  73. return text
  74. }
  75. /*
  76. * Returns the HTML string of an element with its contents converted
  77. */
  78. function outer (node, content) {
  79. return node.cloneNode(false).outerHTML.replace('><', '>' + content + '<')
  80. }
  81. function canConvert (node, filter) {
  82. if (typeof filter === 'string') {
  83. return filter === node.nodeName.toLowerCase()
  84. }
  85. if (Array.isArray(filter)) {
  86. return filter.indexOf(node.nodeName.toLowerCase()) !== -1
  87. } else if (typeof filter === 'function') {
  88. return filter.call(toMarkdown, node)
  89. } else {
  90. throw new TypeError('`filter` needs to be a string, array, or function')
  91. }
  92. }
  93. function isFlankedByWhitespace (side, node) {
  94. var sibling
  95. var regExp
  96. var isFlanked
  97. if (side === 'left') {
  98. sibling = node.previousSibling
  99. regExp = / $/
  100. } else {
  101. sibling = node.nextSibling
  102. regExp = /^ /
  103. }
  104. if (sibling) {
  105. if (sibling.nodeType === 3) {
  106. isFlanked = regExp.test(sibling.nodeValue)
  107. } else if (sibling.nodeType === 1 && !isBlock(sibling)) {
  108. isFlanked = regExp.test(sibling.textContent)
  109. }
  110. }
  111. return isFlanked
  112. }
  113. function flankingWhitespace (node, content) {
  114. var leading = ''
  115. var trailing = ''
  116. if (!isBlock(node)) {
  117. var hasLeading = /^[ \r\n\t]/.test(content)
  118. var hasTrailing = /[ \r\n\t]$/.test(content)
  119. if (hasLeading && !isFlankedByWhitespace('left', node)) {
  120. leading = ' '
  121. }
  122. if (hasTrailing && !isFlankedByWhitespace('right', node)) {
  123. trailing = ' '
  124. }
  125. }
  126. return { leading: leading, trailing: trailing }
  127. }
  128. /*
  129. * Finds a Markdown converter, gets the replacement, and sets it on
  130. * `_replacement`
  131. */
  132. function process (node) {
  133. var replacement
  134. var content = getContent(node)
  135. // Remove blank nodes
  136. if (!isVoid(node) && !/A|TH|TD/.test(node.nodeName) && /^\s*$/i.test(content)) {
  137. node._replacement = ''
  138. return
  139. }
  140. for (var i = 0; i < converters.length; i++) {
  141. var converter = converters[i]
  142. if (canConvert(node, converter.filter)) {
  143. if (typeof converter.replacement !== 'function') {
  144. throw new TypeError(
  145. '`replacement` needs to be a function that returns a string'
  146. )
  147. }
  148. var whitespace = flankingWhitespace(node, content)
  149. if (whitespace.leading || whitespace.trailing) {
  150. content = content.trim()
  151. }
  152. replacement = whitespace.leading +
  153. converter.replacement.call(toMarkdown, content, node) +
  154. whitespace.trailing
  155. break
  156. }
  157. }
  158. node._replacement = replacement
  159. }
  160. toMarkdown = function (input, options) {
  161. options = options || {}
  162. if (typeof input !== 'string') {
  163. throw new TypeError(input + ' is not a string')
  164. }
  165. if (input === '') {
  166. return ''
  167. }
  168. // Escape potential ol triggers
  169. input = input.replace(/(\d+)\. /g, '$1\\. ')
  170. var clone = htmlToDom(input).body
  171. var nodes = bfsOrder(clone)
  172. var output
  173. converters = mdConverters.slice(0)
  174. if (options.gfm) {
  175. converters = gfmConverters.concat(converters)
  176. }
  177. if (options.converters) {
  178. converters = options.converters.concat(converters)
  179. }
  180. // Process through nodes in reverse (so deepest child elements are first).
  181. for (var i = nodes.length - 1; i >= 0; i--) {
  182. process(nodes[i])
  183. }
  184. output = getContent(clone)
  185. return output.replace(/^[\t\r\n]+|[\t\r\n\s]+$/g, '')
  186. .replace(/\n\s+\n/g, '\n\n')
  187. .replace(/\n{3,}/g, '\n\n')
  188. }
  189. toMarkdown.isBlock = isBlock
  190. toMarkdown.isVoid = isVoid
  191. toMarkdown.outer = outer
  192. module.exports = toMarkdown
  193. },{"./lib/gfm-converters":2,"./lib/html-parser":3,"./lib/md-converters":4,"collapse-whitespace":7}],2:[function(require,module,exports){
  194. 'use strict'
  195. function cell (content, node) {
  196. var index = Array.prototype.indexOf.call(node.parentNode.childNodes, node)
  197. var prefix = ' '
  198. if (index === 0) prefix = '| '
  199. return prefix + content + ' |'
  200. }
  201. var highlightRegEx = /lang-(\S+)/
  202. module.exports = [
  203. {
  204. filter: 'br',
  205. replacement: function () {
  206. return '\n'
  207. }
  208. },
  209. {
  210. filter: ["main", "article", "section", "figure", "footer", "header", "body", "figcaption"],
  211. replacement: function (content) {
  212. return content
  213. }
  214. },
  215. {
  216. filter: ['del', 's', 'strike'],
  217. replacement: function (content) {
  218. return '~~' + content + '~~'
  219. }
  220. },
  221. {
  222. filter: function (node) {
  223. return node.type === 'checkbox' && node.parentNode.nodeName === 'LI'
  224. },
  225. replacement: function (content, node) {
  226. return (node.checked ? '[x]' : '[ ]') + ' '
  227. }
  228. },
  229. {
  230. filter: ['th', 'td'],
  231. replacement: function (content, node) {
  232. return cell(content, node)
  233. }
  234. },
  235. {
  236. filter: 'tr',
  237. replacement: function (content, node) {
  238. var borderCells = ''
  239. var alignMap = { left: ':--', right: '--:', center: ':-:' }
  240. if (node.parentNode.nodeName === 'THEAD') {
  241. for (var i = 0; i < node.childNodes.length; i++) {
  242. var align = node.childNodes[i].attributes.align
  243. var border = '---'
  244. if (align) border = alignMap[align.value] || border
  245. borderCells += cell(border, node.childNodes[i])
  246. }
  247. }
  248. return '\n' + content + (borderCells ? '\n' + borderCells : '')
  249. }
  250. },
  251. {
  252. filter: 'table',
  253. replacement: function (content) {
  254. if (content.indexOf("-") == -1) {
  255. var firstline = content.split("\n")[1]
  256. console.log("table", content)
  257. content = firstline.replace(/[^|]/g, " ") + "\n" + firstline.replace(/[^|]/g, "-") + content
  258. }
  259. return '\n\n' + content + '\n\n'
  260. }
  261. },
  262. {
  263. filter: ['thead', 'tbody', 'tfoot'],
  264. replacement: function (content) {
  265. return content
  266. }
  267. },
  268. // Syntax-highlighted code blocks
  269. {
  270. filter: function (node) {
  271. return node.nodeName === 'PRE' &&
  272. node.firstChild &&
  273. node.firstChild.nodeName === 'CODE' &&
  274. highlightRegEx.test(node.firstChild.className)
  275. },
  276. replacement: function (content, node) {
  277. var language = node.firstChild.className.match(highlightRegEx)[1]
  278. return '\n\n```' + language + '\n' + node.innerText.trimRight() + '\n```\n\n'
  279. }
  280. },
  281. // Fenced code blocks
  282. {
  283. filter: function (node) {
  284. return node.nodeName === 'PRE' &&
  285. node.firstChild &&
  286. node.firstChild.nodeName === 'CODE'
  287. },
  288. replacement: function (content, node) {
  289. return '\n\n```\n' + node.firstChild.innerText.trimRight() + '\n```\n\n'
  290. }
  291. },
  292. // Fenced code blocks
  293. {
  294. filter: function (node) {
  295. return node.nodeName === 'PRE'
  296. },
  297. replacement: function (content, node) {
  298. return '\n\n```\n' + node.innerText.trimRight() + '\n```\n\n'
  299. }
  300. },
  301. {
  302. filter: function (node) {
  303. return node.nodeName === 'DIV' &&
  304. highlightRegEx.test(node.className)
  305. },
  306. replacement: function (content) {
  307. return '\n\n' + content + '\n\n'
  308. }
  309. }
  310. ]
  311. },{}],3:[function(require,module,exports){
  312. /*
  313. * Set up window for Node.js
  314. */
  315. var _window = (typeof window !== 'undefined' ? window : this)
  316. /*
  317. * Parsing HTML strings
  318. */
  319. function canParseHtmlNatively () {
  320. var Parser = _window.DOMParser
  321. var canParse = false
  322. // Adapted from https://gist.github.com/1129031
  323. // Firefox/Opera/IE throw errors on unsupported types
  324. try {
  325. // WebKit returns null on unsupported types
  326. if (new Parser().parseFromString('', 'text/html')) {
  327. canParse = true
  328. }
  329. } catch (e) {}
  330. return canParse
  331. }
  332. function createHtmlParser () {
  333. var Parser = function () {}
  334. // For Node.js environments
  335. if (typeof document === 'undefined') {
  336. var jsdom = require('jsdom')
  337. Parser.prototype.parseFromString = function (string) {
  338. return jsdom.jsdom(string, {
  339. features: {
  340. FetchExternalResources: [],
  341. ProcessExternalResources: false
  342. }
  343. })
  344. }
  345. } else {
  346. if (!shouldUseActiveX()) {
  347. Parser.prototype.parseFromString = function (string) {
  348. var doc = document.implementation.createHTMLDocument('')
  349. doc.open()
  350. doc.write(string)
  351. doc.close()
  352. return doc
  353. }
  354. } else {
  355. Parser.prototype.parseFromString = function (string) {
  356. var doc = new window.ActiveXObject('htmlfile')
  357. doc.designMode = 'on' // disable on-page scripts
  358. doc.open()
  359. doc.write(string)
  360. doc.close()
  361. return doc
  362. }
  363. }
  364. }
  365. return Parser
  366. }
  367. function shouldUseActiveX () {
  368. var useActiveX = false
  369. try {
  370. document.implementation.createHTMLDocument('').open()
  371. } catch (e) {
  372. if (window.ActiveXObject) useActiveX = true
  373. }
  374. return useActiveX
  375. }
  376. module.exports = canParseHtmlNatively() ? _window.DOMParser : createHtmlParser()
  377. },{"jsdom":6}],4:[function(require,module,exports){
  378. 'use strict'
  379. module.exports = [
  380. {
  381. filter: 'p',
  382. replacement: function (content) {
  383. return '\n\n' + content + '\n\n'
  384. }
  385. },
  386. {
  387. filter: 'br',
  388. replacement: function () {
  389. return ' \n'
  390. }
  391. },
  392. {
  393. filter: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
  394. replacement: function (content, node) {
  395. var hLevel = node.nodeName.charAt(1)
  396. var hPrefix = ''
  397. for (var i = 0; i < hLevel; i++) {
  398. hPrefix += '#'
  399. }
  400. return '\n\n' + hPrefix + ' ' + content + '\n\n'
  401. }
  402. },
  403. {
  404. filter: 'hr',
  405. replacement: function () {
  406. return '\n\n* * *\n\n'
  407. }
  408. },
  409. {
  410. filter: ['em', 'i'],
  411. replacement: function (content) {
  412. return '_' + content + '_'
  413. }
  414. },
  415. {
  416. filter: ['strong', 'b'],
  417. replacement: function (content) {
  418. return '**' + content + '**'
  419. }
  420. },
  421. // Inline code
  422. {
  423. filter: function (node) {
  424. var hasSiblings = node.previousSibling || node.nextSibling
  425. var isCodeBlock = node.parentNode.nodeName === 'PRE' && !hasSiblings
  426. return node.nodeName === 'CODE' && !isCodeBlock
  427. },
  428. replacement: function (content) {
  429. return '`' + content + '`'
  430. }
  431. },
  432. {
  433. filter: function (node) {
  434. return node.nodeName === 'A' && node.getAttribute('href')
  435. },
  436. replacement: function (content, node) {
  437. var titlePart = node.title ? ' "' + node.title + '"' : ''
  438. return '[' + content + '](' + node.getAttribute('href') + titlePart + ')'
  439. }
  440. },
  441. {
  442. filter: 'img',
  443. replacement: function (content, node) {
  444. var alt = node.alt || ''
  445. var src = node.getAttribute('src') || ''
  446. var title = node.title || ''
  447. var titlePart = title ? ' "' + title + '"' : ''
  448. return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : ''
  449. }
  450. },
  451. // Code blocks
  452. {
  453. filter: function (node) {
  454. return node.nodeName === 'PRE' && node.firstChild.nodeName === 'CODE'
  455. },
  456. replacement: function (content, node) {
  457. return '\n\n ' + node.firstChild.textContent.replace(/\n/g, '\n ') + '\n\n'
  458. }
  459. },
  460. {
  461. filter: 'blockquote',
  462. replacement: function (content) {
  463. content = content.trim()
  464. content = content.replace(/\n{3,}/g, '\n\n')
  465. content = content.replace(/^/gm, '> ')
  466. return '\n\n' + content + '\n\n'
  467. }
  468. },
  469. {
  470. filter: 'li',
  471. replacement: function (content, node) {
  472. content = content.replace(/^\s+/, '').replace(/\n/gm, '\n ')
  473. var prefix = '* '
  474. var parent = node.parentNode
  475. var index = Array.prototype.indexOf.call(parent.children, node) + 1
  476. prefix = /ol/i.test(parent.nodeName) ? index + '. ' : '* '
  477. return prefix + content
  478. }
  479. },
  480. {
  481. filter: ['ul', 'ol'],
  482. replacement: function (content, node) {
  483. var strings = []
  484. for (var i = 0; i < node.childNodes.length; i++) {
  485. strings.push(node.childNodes[i]._replacement)
  486. }
  487. if (/li/i.test(node.parentNode.nodeName)) {
  488. return '\n' + strings.join('\n')
  489. }
  490. return '\n\n' + strings.join('\n') + '\n\n'
  491. }
  492. },
  493. {
  494. filter: function (node) {
  495. return this.isBlock(node)
  496. },
  497. replacement: function (content, node) {
  498. return '\n\n' + this.outer(node, content) + '\n\n'
  499. }
  500. },
  501. // Anything else!
  502. {
  503. filter: function () {
  504. return true
  505. },
  506. replacement: function (content, node) {
  507. return this.outer(node, content)
  508. }
  509. }
  510. ]
  511. },{}],5:[function(require,module,exports){
  512. /**
  513. * This file automatically generated from `build.js`.
  514. * Do not manually edit.
  515. */
  516. module.exports = [
  517. "address",
  518. "article",
  519. "aside",
  520. "audio",
  521. "blockquote",
  522. "canvas",
  523. "dd",
  524. "div",
  525. "dl",
  526. "fieldset",
  527. "figcaption",
  528. "figure",
  529. "footer",
  530. "form",
  531. "h1",
  532. "h2",
  533. "h3",
  534. "h4",
  535. "h5",
  536. "h6",
  537. "header",
  538. "hgroup",
  539. "hr",
  540. "main",
  541. "nav",
  542. "noscript",
  543. "ol",
  544. "output",
  545. "p",
  546. "pre",
  547. "section",
  548. "table",
  549. "tfoot",
  550. "ul",
  551. "video"
  552. ];
  553. },{}],6:[function(require,module,exports){
  554. },{}],7:[function(require,module,exports){
  555. 'use strict';
  556. var voidElements = require('void-elements');
  557. Object.keys(voidElements).forEach(function (name) {
  558. voidElements[name.toUpperCase()] = 1;
  559. });
  560. var blockElements = {};
  561. require('block-elements').forEach(function (name) {
  562. blockElements[name.toUpperCase()] = 1;
  563. });
  564. /**
  565. * isBlockElem(node) determines if the given node is a block element.
  566. *
  567. * @param {Node} node
  568. * @return {Boolean}
  569. */
  570. function isBlockElem(node) {
  571. return !!(node && blockElements[node.nodeName]);
  572. }
  573. /**
  574. * isVoid(node) determines if the given node is a void element.
  575. *
  576. * @param {Node} node
  577. * @return {Boolean}
  578. */
  579. function isVoid(node) {
  580. return !!(node && voidElements[node.nodeName]);
  581. }
  582. /**
  583. * whitespace(elem [, isBlock]) removes extraneous whitespace from an
  584. * the given element. The function isBlock may optionally be passed in
  585. * to determine whether or not an element is a block element; if none
  586. * is provided, defaults to using the list of block elements provided
  587. * by the `block-elements` module.
  588. *
  589. * @param {Node} elem
  590. * @param {Function} blockTest
  591. */
  592. function collapseWhitespace(elem, isBlock) {
  593. if (!elem.firstChild || elem.nodeName === 'PRE') return;
  594. if (typeof isBlock !== 'function') {
  595. isBlock = isBlockElem;
  596. }
  597. var prevText = null;
  598. var prevVoid = false;
  599. var prev = null;
  600. var node = next(prev, elem);
  601. while (node !== elem) {
  602. if (node.nodeType === 3) {
  603. // Node.TEXT_NODE
  604. var text = node.data.replace(/[ \r\n\t]+/g, ' ');
  605. if ((!prevText || / $/.test(prevText.data)) && !prevVoid && text[0] === ' ') {
  606. text = text.substr(1);
  607. }
  608. // `text` might be empty at this point.
  609. if (!text) {
  610. node = remove(node);
  611. continue;
  612. }
  613. node.data = text;
  614. prevText = node;
  615. } else if (node.nodeType === 1) {
  616. // Node.ELEMENT_NODE
  617. if (isBlock(node) || node.nodeName === 'BR') {
  618. if (prevText) {
  619. prevText.data = prevText.data.replace(/ $/, '');
  620. }
  621. prevText = null;
  622. prevVoid = false;
  623. } else if (isVoid(node)) {
  624. // Avoid trimming space around non-block, non-BR void elements.
  625. prevText = null;
  626. prevVoid = true;
  627. }
  628. } else {
  629. node = remove(node);
  630. continue;
  631. }
  632. var nextNode = next(prev, node);
  633. prev = node;
  634. node = nextNode;
  635. }
  636. if (prevText) {
  637. prevText.data = prevText.data.replace(/ $/, '');
  638. if (!prevText.data) {
  639. remove(prevText);
  640. }
  641. }
  642. }
  643. /**
  644. * remove(node) removes the given node from the DOM and returns the
  645. * next node in the sequence.
  646. *
  647. * @param {Node} node
  648. * @return {Node} node
  649. */
  650. function remove(node) {
  651. var next = node.nextSibling || node.parentNode;
  652. node.parentNode.removeChild(node);
  653. return next;
  654. }
  655. /**
  656. * next(prev, current) returns the next node in the sequence, given the
  657. * current and previous nodes.
  658. *
  659. * @param {Node} prev
  660. * @param {Node} current
  661. * @return {Node}
  662. */
  663. function next(prev, current) {
  664. if (prev && prev.parentNode === current || current.nodeName === 'PRE') {
  665. return current.nextSibling || current.parentNode;
  666. }
  667. return current.firstChild || current.nextSibling || current.parentNode;
  668. }
  669. module.exports = collapseWhitespace;
  670. },{"block-elements":5,"void-elements":8}],8:[function(require,module,exports){
  671. /**
  672. * This file automatically generated from `pre-publish.js`.
  673. * Do not manually edit.
  674. */
  675. module.exports = {
  676. "area": true,
  677. "base": true,
  678. "br": true,
  679. "col": true,
  680. "embed": true,
  681. "hr": true,
  682. "img": true,
  683. "input": true,
  684. "keygen": true,
  685. "link": true,
  686. "menuitem": true,
  687. "meta": true,
  688. "param": true,
  689. "source": true,
  690. "track": true,
  691. "wbr": true
  692. };
  693. },{}]},{},[1])(1)
  694. });