You may be using the CSS ::first-line Selector
Example:
div::first-line {
font-weight: bold;
}
<div>
Lorem ipsum dolor sit amet,consectetur adipiscing elit. <br />
Vestibulum erat velit, aliquet at mattis a, tristique ac mauris. <br />
Quisque et neque quis lectus consequat ornare ut eu augue. <br />
Praesent sapien massa, <br />
</div>
<div>
Faucibus sed viverra a, ultrices eget velit. <br />
Aliquam euismod ante eu est tempor posuere. <br />
Duis semper sodales ligula, et lacinia libero iaculis ac. <br />
Duis at elementum diam. Sed lectus justo, <br />
Malesuada eget scelerisque vitae, ullamcorper eget enim. <br />
Nulla vitae turpis luctus, consectetur velit non, mattis lorem. <br />
</div>
Supposing the text with the \n
, be like this:
Lorem ipsum dolor sit amet,consectetur adipiscing elit. \n
Vestibulum erat velit, aliquet at mattis a, tristique ac mauris. \n
Quisque et neque quis lectus consequat ornare ut eu augue. \n
Praesent sapien massa, \n \n
Faucibus sed viverra a, ultrices eget velit.\n
Aliquam euismod ante eu est tempor posuere. \n
Duis semper sodales ligula, et lacinia libero iaculis ac.\n
Duis at elementum diam. Sed lectus justo, \n
Malesuada eget scelerisque vitae, ullamcorper eget enim.\n
Nulla vitae turpis luctus, consectetur velit non, mattis lorem.\n
You’ll have to treat the \n
.
if(!String.IsNullOrEmpty(texto)){
texto = texto.Insert(0, "<div>");
texto = texto.Replace("\n \n", "</div><div>");
texto = texto.Insert(texto.Length, "</div>");
texto = texto.Replace("\n", "<br />");
}
Example
What do you think to use to mark the bold style?
– Leonel Sanches da Silva
I will explain a little better. In case the tool is practically an "html generator". As a final process, I will display a code for the user. The markup can be with <Strong> for example...
– Rafael Barbosa
Why not use a WYSIWYG editor that uses HTML tags only?
– Leonel Sanches da Silva
By the way, Ckeditor allows you to configure how the HTML will be generated, for example: http://nightly.ckeditor.com/15-01-26-07-08/full/samples/plugins/htmlwriter/outputhtml.html
– Leonel Sanches da Silva