How can i convert/replace every newline to '
'?

前端 未结 5 1655
南笙
南笙 2021-01-21 05:55
set tabstop=4
set shiftwidth=4
set nu
set ai
syntax on
filetype plugin indent on

I tried this, content.gsub(\"\\r\\n\",\"
\")
bu

5条回答
  •  执念已碎
    2021-01-21 06:15

    An alternative to convert every new lines to html tags
    would be to use css to display the content as it was given :

    .wrapped-text {
        white-space: pre-wrap;
    }
    

    This will wrap the content on a new line, without altering its current form.

提交回复
热议问题