Display Code

Sometimes you may want to display code for your readers to copy and paste from an article. Here's how:

  1. Click on Source in your WYSIWYG editor.
  2. Paste the code you want to display into the Source.
  3. Wrap the code using the following format: <pre><code data-language="language"></code></pre> tags.
  4. Replace "language" with the language of the code. For example: data-language="javascript"

Note: If you are showing a full script, you will want to HTML encode the opening and closing script tags so that the code does not run as is shown above. Here's an online tool you can use to encode your script.

Here's what the above code looks like when shown in an article:

      alert("Hello, World!");