High-Performance Development - C#, VB, SQL, ASP.NET

Slogan Text

Here's the best process for adding\editing code snippets in an Html content container that I could determine after copying and pasting several code snippets into a Mojoportal site.

  1. Copy the code snippet from the source document. See note below for copying from Microsoft Word.
  2. Open for editing the destination content container in the Mojoportal site.
  3. Click on Source icon in the upper-left corner of the Html editor.
  4. Paste the code snippet into the editor.
  5. Insert <pre> and <code> tags before the code snippet.
  6. Insert </code> and </pre> tags after the code snippet.
  7. Click on Update button or Source icon.




    A = 1;



  • If you copy code snippets from a Microsoft Word document you'll get a ton of formatting commands\tags.

    You can purge the formatting commands\tags by doing this: paste the text into Notepad, copy and paste the text from Notepad, and then insert into the Mojoportal Html editor.
  • If you leave off the <pre></pre> tags the code snippet will lose formatting and you'll have to hand insert non-breaking spaces to reformat the code snippet. That can be tiring.

    The better approach appears to be enclosing the code snippet with <pre></pre> tags.
  • Do not try to set the Code style using the WYSIWYG editor and the Styles drop down list. Doesn't do the right things for me.
  • Suppose you copy and paste text and code snippets into the Html content container in Html mode and then switch to WYSIWYG editing mode.  The WYSIWYG editor arbitrarily adds <pre></pre> and <code></code> tags around text paragraphs, list items, and doubles up on <code></code> tags. I'm not sure why this happens.

    Either way you might need to go into HTML editing mode (click Source icon in upper left hand corner of the editor) and hand remove the extra tags.

If any one has additional ideas I'm open to hearing them.