alltomp3 icon indicating copy to clipboard operation
alltomp3 copied to clipboard

Fix lyrics formatting

Open tgambet opened this issue 6 years ago • 0 comments

You could improve the following formatting logic :

https://github.com/AllToMP3/alltomp3/blob/7129f174ac8d9d9726b252eabe447260d5e12216/index.js#L75-L80

With :

html = html.text()
    .replace(/\r\n/g, '\n') // windows to linux new line style
    .replace(/\t/g, '') // no tabs
    .replace(/ +/g, ' ') // whitespaces
    .split('\n').map(line => line.trim()).join('\n') // trim every line
    .replace(/\n{3,}/g, '\n\n'); // no more than two new lines in a row

This would fix the formatting issues seen on lyrics.ovh.

tgambet avatar Dec 15 '18 14:12 tgambet