Code Embed Demonstration

As a development theme, it’s only fitting that it’s easy for people to share code. DevWP uses Prism.js which is great for adding and sharing code.

How to use Prism:

  • First thing to note is that I recommend only using the text editor when sharing code since the visual editor can cause issues with embedded code.
  • Next, check out how to properly embed code by using the pre tag followed by the code tag which will need a class with the language-js or language-php etc in order to work.
  • Then in between the opening and closing pre & code tags, place your code
  • You can checkout the basic usage on the Prism Website

function square(number) {
  return number * number;
}