How to Display Formatted Text From HTML in Tapestry - html

In my TextArea, I'm using CKEditor as a mixins, and all changes, include the formatting goes to my DB. How to display it as formatted text, which means if HTML is <b>My Name</b> is <i>Hobas</i> will displayed as My Name is Hobas. I've tried JSoup but it looks like that lib doesn't support this job.

Use the OutputRaw component in your template (.Tml) file:
See http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/components/OutputRaw.html

Related

Render HTML instead of plain text in Angular2

I have a component with encapsulationset to ViewEncapsulation.None and a property named question which contains text from server call, which might contain HTML tags like
<strong>Main Question</strong> and some more text
in my view I use the property like this
...
<p [innerHTML]="question"></p>
...
and the produced HTML is
<p>
<strong>Main Question</strong> and some more text
</p>
but the thing is that strong tag apart from the semantics should also make the text bold, which doesn't happen.
1) Why this happens and browser does not render it correctly?
2) which is the correct way to fix it?
I know there are similar questions but they couldn't help.
Angular Version Used: Angular 2.4.7

How to convert plain text to html but keep the display format?

I have one plain text which is program output, but I want to display it in html page. But still I want to keep the formats (like space/tab/enter and etc.), it's just like the code block of stackoverflow, how can I display it properly in html ? Thanks
Use the "pre" and "code" HTML tags:
<pre><code> code in here... </code></pre>
<code> the program</code>

tinymce : how to convert raw html tags?

i used tinymce to allow people to write content. But now i wan't them to edit their own content, i need to use tinymce again.
My problem is in my database, this content is composed of html tags, and when i try to load the text in my tinymce textarea (in edit view), i've got the raw content eg <p> Hello my name is <em>John</em> [...] </p> . But when they written this content, it was with "wysiwyg".
I want to convert this raw html to wysiwig.
here a screenshot of the raw html
and i want it to be like this when they click on "edit my content" button :
I use this:
echo <textarea name="icerik" id="editor1" rows="10" cols="80">'.htmlentities($satir->icerik).'</textarea>;
I use "htmlentities" method in php to convert html code to wysiwyg. When you write that converted text between and , you can get what you want.
Assuming you're using PHP of course. If not, try to search like for example "htmlentities in asp.net" or wait for another answers.
tinyMCE.activeEditor.setContent('<span>html data from your database</span>');
Use this:
strip_tags(stripslashes('row html content'))

How to display html format in text area

I have created but now when user add html formating in that text area with html codes like
<b>the codes are working </b>
they are showing up same as written, instead of "the codes are working "
so how do i enable that in simple HTML form.
Textarea cannot display any html structure. You should use <pre> tag, but if you want to edit in the same time, use contenteditable attribute.
<pre contenteditable="true"><b>the codes are working</b></pre>
I think that you are trying some editor. You can use CKEditor. Quirksmode.org also can be useful.

Show html code as rendered html text

I am trying to take some input from the user with the wisywig text editor plugin. But, when I try to show the text in a label or paragraph, all the html tags become visible.
For example,
#string str = "<b>sample text</b>";
<label>#str</label>
should look like
sample text
But it is not. It looks like,
<b>sample text</b>
How can I render a html code string into a html text...???
i am working with .net mvc3 with razor view engine...
That may happen if HTML entiries are being encoded.
You need to avoid that encoding or do decoding. For example, in PHP you can use http://php.net/manual/en/function.html-entity-decode.php to decode HTML entities.