Sometimes you may want to display code for your readers to copy and paste from an article. Here's how:
- Click on Source in your WYSIWYG editor.
- Paste the code you want to display into the Source.
- Wrap the code using the following format: <pre><code data-language="language"></code></pre> tags.
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:
<script> alert("Hello, World!"); </script>