So there are a few paragraphs separated by line feeds "\r\n" in a textarea, say
Paragraph1 "\r\n"
Paragraph2 "\r\n"
Paragraph3 "\r\n"
what i want to achieve is to process each paragraph into
tag. How do you do that? (Need a server side solution) so it looks like<p> Paragraph 1 </p>
<p> Paragraph 2 </p>
<p> Paragraph 3 </p>
On top of the complexity, if you have a blockquote there
Paragraph1 "\r\n"
<blockquote> "\r\n"
test
</blockquote> "\r\n"
Paragraph2 "\r\n"
Paragraph3 "\r\n"
should co开发者_开发技巧me out to look like
<p> Paragraph 1 </p>
<blockquote>
<p>test</p>
</blockquote>
<p> Paragraph 2 </p>
<p> Paragraph 3 </p>
Thanks a lot
ps: I see stackoverflow does a good job at that.
Maybe it's a bit overkill for what you want to do, but Stackoverflow uses Markdown. There is at least one ASP.NET converter available: Markdown.NET
You are not creating paragraphs with "\r\n"
, you're creating line-breaks. If you want paragraphs, use a WYSIWYG editor.
精彩评论