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

前端 未结 5 1656
南笙
南笙 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:21

    I'm not sure I exactly follow the question - are you seeing the output as e.g. preformatted text, or does the source HTML have those tags? If the source HTML has those tags, they should appear on new lines, even if they aren't on line breaks in the source, right?

    Anyway, I'm guessing you're dealing with automatic string escaping. Check out this other Stack Overflow question Also, this: Katz talking about this feature

提交回复
热议问题