diff --git a/lib/models/LineConverter.js b/lib/models/LineConverter.js index ff1a1c7f..cfd0856c 100644 --- a/lib/models/LineConverter.js +++ b/lib/models/LineConverter.js @@ -140,7 +140,9 @@ function combineText (textItems) { if (!text.endsWith(' ') && !textToAdd.startsWith(' ')) { if (lastItem) { const xDistance = textItem.x - lastItem.x - lastItem.width - if (xDistance > 5) { + if (xDistance > 15) { + text += ' ' + } else if (xDistance > 5) { text += ' ' } } else { diff --git a/lib/models/transformations/ToMarkdown.js b/lib/models/transformations/ToMarkdown.js index c8293d54..ca008640 100644 --- a/lib/models/transformations/ToMarkdown.js +++ b/lib/models/transformations/ToMarkdown.js @@ -21,8 +21,15 @@ module.exports = class ToMarkdown extends Transformation { } // Concatenate words that were previously broken up by newline + // (handled below per block type) + + // Ensure each bullet point starts on its own line + concatText = concatText.replace(/ • /g, '\n• ') + + // Concatenate words that were previously broken up by newline + // Only remove hyphens at line breaks (word continuation), not in content if (block.category !== 'LIST') { - concatText = concatText.split('- ').join('') + concatText = concatText.replace(/(\w)- \n(\w)/g, '$1$2') } // Assume there are no code blocks in our documents