Move line merging algorithm to from editing.js to html.js