Displaying code in a wiki

Does anyone know if there is a convenient way of displaying source code on a wiki page? Sure, I can select the text and make it monospace, then manually fix the spacing, etc... but is there a magic button to press or magic html tags to put in so that a block of source code shows nicely on my wiki page? (e.g. a series of unix commands, or a block of C code)?
Thanks,

I have been working on a solution to displaying properly formatted and colorized code in the wiki. I am using a javascript and css from http://notebar.com/CodeColor.html
So far it I have modified the tags in whitelist.plist so that it accepts the 'lang' attribute on the <pre> tag. I have edited the css so that the codecolor.css is included in the theme I am using. I have modified the javascript so that there is an event that fires when the page loads in the wiki to add the formatting and color codes to the dom of the wiki text, and the code is displayed exactly as I want it.....
That is, until I try to edit the page containing the code. What happens then is that the editor opens with the contents of the DOM, after formatting, rather than the raw wiki text that was stored and saved. Then the code becomes an absolute mess because the event that formats the code is fired a second time and makes an absolute mess of the html and the original wiki text with the embedded code.
Is there anyway to have the editor load the saved wiki content rather than the unsaved DOM representation?
John Davidson

Similar Messages

  • Why are most websites only displaying code like text?

    Almost all of the web sites that I frequent have began displaying code like text on a blank white background. Some sites still have hyperlinks and images here and there with random text, but others are fully blank with what appears to be the code of the website showing. I wasn't able to access this web site until I tried multiple times and it magically worked, but others are still not working. The only sites that I have tested that have worked from the start are Google related sites (Gmail, Google, Youtube). My yahoo email is inaccessible, which is an important email for me and all other sites that i frequent are inaccessible. One major thing to note is that the sites are also inaccessible on Internet Explorer. This would typically lead you to believe that the problem lies with your connection in some way. I have reset my router/modem and it had no effect. I also have ran CCleaner and have deleted temp files, cookies, and caches. I have tried running Mozilla in safe mode with add-ons disabled as well. My malware protection and antivirus protection find no issues after completing full scans. One last thing to note is that, on both Firefox and IE, certain sites allow to me to access the homepage, such as yahoo, but once I attempt to check my mail the random display of code appears. On IE it simply says that the site cannot be displayed once I click to check my mail. Gmail works perfect on the other hand. The only things that I have done during this time are:
    Setup a LogMeIn account (Hamachi) and connected my PC to their service
    Downloaded and began using Malewarebytes software to remove malware that I had picked up
    Other than those two things it has been the same usual actions on my PC. Could the malware that I had still be effecting me somehow even though it was found/deleted? Is my router to blame even though resetting it does not help? After all the things I have tried, what could it be?

    What is the content type of those pages if you check that via Tools > Page Info > General?
    Is that text/html as it should be or text/plain as your screenshot would suggest?
    You can also check the Net log via the Web Console (Web Developer > Web Console;Ctrl+Shift+K)
    *https://developer.mozilla.org/en/Tools/Web_Console
    *https://developer.mozilla.org/en/Using_the_Web_Console
    This can be a problem with your firewall that modifies the server response headers if the settings in Firefox are correct.
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox
    *https://support.mozilla.org/kb/Basic+Troubleshooting
    A possible cause is security software (firewall,anti-virus) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls
    Try to boot the computer in Windows Safe mode with network support (press F8 on the boot screen) as a test to see if that works.

  • Create report  to display CODE ( e.g  RC , VP ext) coming in tcode Me23n

    Hi ,
    I need to create report in orde to display CODE ( e.g  RC , VP ext) coming in tcode Me23n.Could any one tell me table to fetch with respect to purchacing document number.
    Regards.

    Hi
    You can use ME2M, ME2N, ME2L, ME2K ME80FN etc.,
    Regards,
    raman

  • Playing Quicktime won't work in Safari, displays code.

    Using my iPhone 3GS, I've attempted to load Quicktime Movies from websites and it just displays code. Whereas, on my old iPod Touch it would display just fine. The podcasts from the ESPN Podcenter WebApp is a perfect example of this. Can anybody help?

    i found out how to make it work,
    Settings > Safari > and make sure Plug-Ins is set to on and then try your website.
    it worked for me.

  • Compaq hp 15-h002SF POWER ON OR ADMINISTRATOR PASSWORD DISPLAY CODE: 59937925

    compaq hp 15-h002SF POWER ON OR ADMINISTRATOR PASSWORD DISPLAY CODE: 59937925

    Hi: Please read this post which should resolve your dilemma. http://h30434.www3.hp.com/t5/Notebook-Operating-Sy​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​stems-and-S​... Then... You can: 1. Use the unlock code you generated to enter the BIOS
    2. Disable all passwords that are enabled in the BIOS's security menu.
    3. If asked for current password - type the unlock code
    4. For new password, just press ENTER key
    5. Repeat the same for verify password column.

  • Displaying code

    I am curious if there is a simple way to display code that is
    produced by my cfm? I have a site that takes in variables and
    produces an html webpage. I show the page in an iframe, but also
    want to supply the code generated for that page in a text-area for
    the user to copy and paste (possibly to email them as well with
    cfmail). I figured I could simply make a seperate section of the
    code that would just write the code to a variable and I display the
    variable, but that could be a bit cumbersome and would essentially
    make my code grow by 2x. If anyone has a suggestion, please let me
    know. Thank you.

    View source?
    Otherwise, you would do what you just described - output the
    code to a variable that is displayed in a textarea.

  • How do you display code in a forum post

    Hey
    Just a quick question to ask how i display my code on these message boards if im having a problem with them?
    because i can see its not a simple copy and paste
    Thanks

    It's in fact very easy. You can post code and then surround it with code tags. The new code tags look like this:
    &#123;code}
    x=y;
    z=w;
    &#123;code}
    The old code tags look this this:
    [code]
    x=y;
    z=w;
    [[/i]code]
    They work the same. If you don't feel like typing in tags, there is a "code" button right there next to the bold, italics, underline buttons... Just select your code and press the code button.

  • In jsp how to display code?

    in jsp how to display some code like this:
    String body=body1;
    String body_new="";
    int Position = 0;
    while(true){
    int index = body.indexOf(0x0D, Position);
    if(index == -1){break;}
    if(index > Position){
    body_new += body.substring(Position, index);
    body_new += "<br>";
    Position = index +1;
    if(Position >= 0){
    body_new += body.substring(Position);
    body=body_new;
    ==================
    i find IE will not display the "<br>" and some char like "'"
    i use text textarea post
    thanks

    let us say this page as code.jsp
    code.jsp
    this is the u need to follow.........
    String body=body1;
    String body_new="";
    int Position = 0;
    while(true){
    int index = body.indexOf(0x0D, Position);
    if(index == -1){break;}
    if(index > Position){
    body_new += body.substring(Position, index);
    body_new += "<br>";
    Position = index +1;
    if(Position >= 0){
    body_new += body.substring(Position);
    body=body_new
    this is the sample usage ok

  • Reg:DISPlay code in wdabap

    Hi Experts
    How are you?Hope all are doing great and fine.
    Actually i am very new to wdabap coding but working on that technology where i have designed an wdabap application in that  there is a button named display when i click on that button all the UI elements what ever i have used in the application should be displayed in non-editable mode ,means just it should display in inactive state.
    could you please share your knowledge regarding coding.
    Thanks in Advance.
    Regards
    Deepika

    hi
    do not use IMPORTING parameter for set_attribute method .. map ur component controller context nodes to view and disable the fields in the event handler ..
    1) bind the read Only property of all the UI elements which you want to be in display mode to that context attribute :
    when i do this all are in non editable mode but this should happen when i click on display button only.but when i test the application all are in non edit mode if i do above procedure.
    yes , this is why u need to create a action for ur button .. u can find a Action property for ur button UI .. create a action and then write the code for enable/disable of the fields in this method
    can please give me the coding how to write in
    refer to my earler post ..
    one correction ..
    set the value to ' ' for disable and 'X' for enable .. instead of '01' and '02' ... use the set_attribute method
    2)Initially if you want all those to be in editable mode, then you can set that attribute value to abap_false:
    Is this should be written in wddoint method of the application.
    by default the fields are in the enable mode. if u wish them to be disable mode, u can write the coding in WDDOINIT method..
    u can accordingly change them to enable/disable them in the onAction method of ur button UI
    3)event handler of your button, set that attribute to abap_true so that all the UI elements will becom readonly:
    Is this should be written in display button action.
    if u set the attribute in the event handler  to 'X' or 'ABAP_TRUE' fields will be in enable mode
    if set to ' ' or 'ABAP_FALSE' vice versa ..
    regards,
    Amit

  • Issues viewing Apps - displaying code page starting 'page-type'

    Hi Folks,
    I've noticed something weird with both of my iPhone 4's on the three network...
    When I select Apps on the App store - rather than the correct page being displayed, I get this weird page full of code - starting with things like...
    page-type template-namesoftware template-parameters titleInfo store-version1.0 etc...
    Anyone seen anything like this before?
    Thanks
    Gavin

    I'll add another one to that list.
    I was told originally to downloaded latest software, some reason mine only had 4.0 not 4.01 on there. But still same problems. Spoke to 3 today and they are sending me a replacement handset.
    Would prefer a solution if it is the network though as have just inputted all my contacts,can't bear to go through that again!
    Would love to understand a solution if anyone has one!!?

  • Problems saving/ displaying codes

    Hello,
    I want to save html codes or any language code in my database.
    For instance, am saving the text below in the database :
    <!--- STRIP OUT ALL HTML --->
    <cfset test = StripToHTML.stripHtml(VARIABLES.text, "all")>
    <cfdump var="#test#"><br/>
    <!--- STRIP OUT IMG, B, AND EM TAGS --->
    <cfset test1 = StripToHTML.stripHtml(VARIABLES.text, "img,tag,false;b,tag,true;em,content,true")>
    <cfdump var="#test1#"><br/>
    When it has been saved in the database, it's like follows :
    &lt;!--- STRIP OUT ALL HTML ---&gt;
    &lt;cfset test = StripToHTML.stripHtml(VARIABLES.text, "all")&gt;
    &lt;cfdump var="#test#"&gt;&lt;br/&gt;
    &lt;!--- STRIP OUT IMG, B, AND EM TAGS ---&gt;
    &lt;cfset test1 = StripToHTML.stripHtml(VARIABLES.text, "img,tag,false;b,tag,true;em,content,true")&gt;
    &lt;cfdump var="#test1#"&gt;&lt;br/&gt;
    And when I am displaying it on a page, it displayed as above.
    Someone can tell me how to save the codes in the correct format in the database and how to make them display correctly ?
    I am using MSSQL 2008 for the database.

    well I have used the function safetext but unfortunately its not good.
    I have test it with the test below :
    Hello V/s <b>Hello</b>
    and the result after using safetext qive me the result :
    Hello  V/s &lt;b&gt;Hello&lt;/b&gt;
    I have already do a rereplace function to replace the &lt; and &gt; with <> but this would appear like :
    Hello  V/s Hello
    Instead of showing the tag b , it execute the html tag.
    I don't know how to make any codes appear on a page.
    Could anyone please help me ?

  • Curve 8520 lcd display code???

    i have just taken my phone apart to get a replacment lcd display and the only code i can find on it is  ASY-22758-003 ... can anyone tell me which screen i should get... Im confused!?!?!?  

    please help

  • Photosmart 6510 Printer error/Blue screen on printer display Code:B864F472

    Hello
    I'm having a reoccurring problem with my HP Photosmart 6510 all-in-one. The printer will stay on for about five minutes, give or take, and proceed to flash a blue screen (on printer display) with error code B864F472
    Next the screen displays a "Printer Error" message followed by "Please turn printer off and then on" with all lights on the printer flashing.
    It will display this until I cycle the power and it repeats the same behavior after about five minutes.
    I've searched extensively for a solution and have tried multiple things. Such as:
    -Unplugging from back of printer and wall, 30 sec wait then plug back in.
    -Clean cartridge and print header contacts.
    -Set static IP.
    -Printed various reports from service mode, No errors, Excellent signal strength.
    -Connected to laptop through USB.
    -Partial reset, Semi-Full reset.
    -Reinstalled drivers on all computers.
    -Updated firmware/software on printer itself.
    -Ran HP Print and Scan Doctor.
    -Reset Router
    I'm at a loss now. The unit is just over a year old. I have two laptops and a desktop on the same network. Two computers running Windows 8.1 64-bit and the other Windows 7 64-bit.
    Any help will be appreciated. Thanks in advance.
    -Lee

    I have the same problem. and no solution
    All seems to work before the 5 minuts (I can print diagnostic page from the PC), then I think it a microcode problem ...

  • Constant Contact's HTML signup form not working in iWeb 3.3, only displays code

    I'm trying to add an email signup form to my iWeb 3.3 website.  I use Constant Contact for my email and event marketing and they provide the code to paste into one's HTML code (I can post the code if need be).  When I use the HTML Snippet widget to do this, however, instead of getting the form I get messy bits and pieces of code not only in iWeb but in the published version of my website.  Any ideas would be greatly appreciated.

    @Old Toad - Check, I definitely pasted into the appropriate box.
    @Wyodor - Tried your suggestion, but it resulted in nothing being displayed.  I guess it's better than messy code being displayed, but still no good.
    Here is the script I was given by Constant Contact:
    <!-- BEGIN: Constant Contact Stylish Email Newsletter Form -->
    <div align="center">
    <div style="width:160px; background-color: #ffffff;">
    <form name="ccoptin" action="<a href="http://visitor.r20.constantcontact.com/d.jsp">http://visitor.r20.constantcontact.com/d.jsp</a>" target="_blank" method="post" style="margin-bottom:3;"><span style="background-color: #006699; float:right;margin-right:5;margin-top:3"><img src="<a href="https://imgssl.constantcontact.com/ui/images1/visitor/email1_trans.gif">https://imgssl.constantcontact.com/ui/images1/visitor/email1_trans.gif</a>" alt="Email Newsletter icon, E-mail Newsletter icon, Email List icon, E-mail List icon" border="0"></span>
    <font style="font-weight: bold; font-family:Helvetica; font-size:16px; color:#006699;">Sign up for our Email Newsletter</font>
    <input type="text" name="ea" size="20" value="" style="font-family:Verdana,Geneva,Arial,Helvetica,sans-serif; font-size:10px; border:1px solid #999999;">
    <input type="submit" name="go" value="GO" class="submit"  style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:10px;">
    <input type="hidden" name="llr" value="xkgu59fab">
    <input type="hidden" name="m" value="1105784871255">
    <input type="hidden" name="p" value="oi">
    </form>
    </div>
    </div>
    <!-- END: Constant Contact Stylish Email Newsletter Form -->
    <!-- BEGIN: SafeSubscribe -->
    <div align="center" style="padding-top:5px;">
    <img src="<a href="https://imgssl.constantcontact.com/ui/images1/safe_subscribe_logo.gif">https://imgssl.constantcontact.com/ui/images1/safe_subscribe_logo.gif</a>" border="0" width="168" height="14" alt=""/>
    </div>
    <!-- END: SafeSubscribe -->
    <!-- BEGIN: Email Marketing you can trust -->
    <div align="center" style="font-family:Arial,Helvetica,sans-serif;font-size:10px;color:#999999;">
    For <a href="<a href="http://www.constantcontact.com/jmml/email-newsletter.jsp">http://www.constantcontact.com/jmml/email-newsletter.jsp</a>" style="text-decoration:none;font-family:Arial,Helvetica,sans-serif;font-size:10 px;color:#999999;" target="_blank">Email Newsletters</a> you can trust
    </div>
    <!-- END: Email Newsletters you can trust -->
    Any ideas?

  • Browser compatability: Netscape 6 displays code

    Tuesday, March 05, 2002 8:50 AM (NEW!)
    I am now doing browser compatability testing with Netscape 6; I developed a site using IE 6: After logging in using the login page, the homepage simply displays one line of code:
    <%@page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%> <% rsJournal.close(); ConnrsJournal.close(); %>
    Why is my programming code displaying in the Netscape browser? What is the solution to this? Does the solution present any repercussions with other browsers?
    -Michael

    Do you have anything in your server code that does different things based on the browser making the request? If so, that's where I would start looking.

Maybe you are looking for