Highlighting syntax in a html text editor - html

All,
In a html textarea is it possible to hightlight c and cpp syntax.If do please indicated an example code for it.
int main()
Int should be highlighted in this case since it is a keyword.

http://www.cdolivet.com/index.php?page=editArea&sess=ba6469857a2ab4dacc7dc4a7b65545f5
and
http://codepress.sourceforge.net/
are two very good options. I'm a fan of the first, but it's more work to set up.

you would need a scripting language (like PHP or JavaScript) to parse the text in the textarea and surround the keywords with a tag such as word . Then in your css you can add a style for class keyword

Try Ace Editor!
Support over 110 languages

Related

ruby tags for Sphinx/rst

I create HTML documents from a rst-formated text, with the help of Sphinx. I need to display some Japanese words with furiganas (=small characters above the words), something like that :
I'd like to produce HTML displaying furiganas thanks to the < ruby > tag.
I can't figure out how to get this result. I tried to:
insert raw HTML code with the .. raw:: html directive but it breaks my line into several paragraphs.
use the :superscript: directive but the text in furigana is written beside the text, not above.
use the :role: directive to create a link between the text and a CSS class of my own. But the :role: directive can only be applied to a segment of text, not to TWO segments as required by the furiganas (=text + text above it).
Any idea to help me ?
As long as I know, there's no simple way to get the expected result.
For a specific project, I choosed not to generate the furiganas with the help of Sphinx but to modify the .html files afterwards. See the add_ons/add_furiganas.py script and the result here. Yes, it's a quick-and-dirty trick :(

Html tags inside of double quote

I need to bold the words inside of double quotes.
title="Character needs to be bold"
When i put <b></b> inside of title's double quote. it just displays them as it is.
So, Is there any way i can bold the characters inside the double quotes?
Are you trying to markup the text inside a title attribute? Because that's not going to work, you'll have to resort to some kind of extended tooltip solution (can be js, but there's also ways to do it with just html/css).
See this question:
Tooltip with HTML content without JavaScript
Some more context would be appreciated though, just the title attribute doesn't give us much information
Title was edited to give context, my answer remains the same.
There is a way depending on the node you are using the 'title' attribute under. See if it has a 'format' attribute as by default the title is set to 'text'. If so, set the format="html", then you will be able to use <b> within your title.
As far as i know you cannot format the string, that is used as the title of a html document. That ist the String, that will get the titel of the tab or window of the browser etc.
If you have a html-entity, that needs formatting, you can format the whole thing with style="your css style", or other css integration. If you have a switch of formatting inside one html entity, you schould look after dividing it up into multiple entities or using another aproach. Do you have a complete example?
cheers,
nx
use < b > Character needs to be bold < / b>
no spaces in between the b and the symbols

Avoid interpreting HTML code in a QTextBrowser

I have a QTextBrowser in my Qt application. I would like to append some text but, I need part of this text not to be interpreted in HTML. How can I achieve this? May I encode the QString?
If you want your browser not to interpret only parts of your text as HTML you will need to quote the part you want to omit (replace "<" with "&l t;" etc.). You can use convenient escape method:
textBrowser->insertHtml(
QString("<b>this will be bold</b>") +
Qt::escape(QString("<b>this will not</b>"))
);
If you would like not to interpret the whole thing you can insert it as plain text:
textBrowser->insertPlainText ( "<b>foobar</b>" );
Finally I solved my own question using:
QString codedHtml = Qt::escape(html);

Reg Exp To Remove 'onclick' from HTML elements (Notepad++)

I have a big html file (87000+ lines) and want to delete all occurrences of onclick from all elements. Two examples of what I want to catch are:
1. onclick="fnSelectNode('name2',2, true);"
2. onclick="fnExpandNode('img3','node3','/include/format_DB.asp?Index2=3');"
The problem is that both function names and parameters passed to them are not the same. So I need a Regular expression that matches onclick= + anything + );"
And I need one that works in Notepad++
Thanks for helping ;-)
Not familiar with notepad++, but what I use in vim is:
onclick="[^"]+"
Of course this depends on there being double quotes around the onclick in every case...
This regular expression will fail if you have a " or ' character included within quotes escaped by a \. Other than that, this should do it.
(onclick="[^"]+")|(onclick='[^"]+')
onclick="[^"]+" works for me, for that 2 strings.
If you want to go with a regex:
/onclick=".*?"/
You could also use something which is DOM-aware, such as a HTML/XML parser, or even just load up jQuery:
$("[onclick]").removeAttr("onclick");
... and then copy the body HTML into a new file.
Could
onclick=\".+;\"
Work?
onclick=\".*\);\"
This regex should do the trick.
(\s+onclick=(?:"[^"]+")|(?:'[^']+'))
Open your file on dreamweaver, choose edit from the toolbar, select find and replace,
put onclick="[^"]+" in find field and keep replace blank
this will do the whole thing.
Enjoy

Superscript registered mark '®' inside select menu

Is is possible to have a superscript registered mark "®" inside a select menu? If so, how is this done? Can you use CSS to achieve this?
There's no way to make a single character superscript inside an <option>. You're stuck with a regular ® (®).
You can achieve results in tough cases using this method to superscript special characters with jQuery.
But I must admit that inside an option... I'm blank.
CSS1 : The numbers need tweaking depending on your font and point size.
<div style="font-size:96px;">
Registered<span style="vertical-align:2.7em; font-size:0.2em;">®</span>
</div>
You can use this key shortcut for ®:
Ctrl + Alt + R
I don't know if this is possible with CSS but in html you could write:
Company<sup>®</sup>