Opened 18 years ago
Closed 18 years ago
#612 closed New Feature (duplicate)
Source code hightlighting
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | UI : Source View | Version: | |
| Keywords: | SF Confirmed | Cc: | saul11@…, Alfonso Martínez de Lizarrondo |
Description
Hi,
building in sourcecode highlighting would be great. Parsing the source when going to html mode, and parsing it back when going to WYSIWYG mode. Should be to resource intensive.
example code (thnx @ Quist):
// parse all tags and make red
defaultTag = /(<([\s\S]*?)>)/gi;
code = code.replace(defaultTag, "<font
color='#FF0000'>$1</font>");
// give centain elements a other color
var aItems = [['style','#00FF00'], ['script','#00FF00']];
for (var i = 0; i < aItems.length; i++) {
var sTag = aItems[i][0];
var re = new RegExp("(<(" + sTag + "|\/" + sTag +
")(.*?)>)", "gi");
code = code.replace(re, "<font color=" + aItems[i][1]
+ ">$1</font>");
}
// make attribute's blue
var reAttr = new
RegExp("(=((\"|")(.*?)(\"|"))( |\/|>))",
"gi");
code = code.replace(reAttr, "=<font
color='#0000FF'>$2</font>$6");
Moved from SF:
http://sourceforge.net/tracker/index.php?func=detail&aid=1097036&group_id=75348&atid=543656
Change History (6)
comment:1 Changed 18 years ago by
| Cc: | saul11@… Alfonso Martínez de Lizarrondo added |
|---|---|
| Reporter: | changed from Martin Kou to anonymous |
comment:3 Changed 18 years ago by
Interesting approach to "background" highlighting:
http://regexpal.com/
comment:4 Changed 18 years ago by
comment:5 Changed 18 years ago by
| Keywords: | Confirmed added |
|---|
This is a DUP of #602 however there is a lot of information regarding to the request in this ticket so I'm leaving it opened.

Incorporated could be a system like http://www.cdolivet.net/index.php?page=editArea or http://codepress.org/index.php or only a higlight script http://www.howtocreate.co.uk/jslibs/script-syntax (permission needed of author)
Moved from SF. Original poster: saul11
Comments from https://sourceforge.net/tracker/index.php?func=detail&aid=1520659&group_id=75348&atid=543656 (dup)
A syntax highlighting text editor in javascript. http://helene.muze.nl/ Distributed under GNU General Public License (GPL).
Very cool SyntaxHighlighter:
dp.SyntaxHighlighter http://www.dreamprojections.com/syntaxhighlighter/ Distributed under GNU Library or "Lesser" General Public License (LGPL)
Moved from SF. Original poster: alfonsoml