JDoodle for WordPress
This plugin helps users to execute their code snippets online in various languages directly within Wordpress sites. This plugin uses following softwares/services,
- Enlighter plugin - for syntax highlighting
- https://www.jdoodle.com - to run the code online.
JDoodle for WordPress uses Enlighter WordPress plugin for syntax hightlighting.
- Install the Enlighter plugin and activate it.
- Download the ZIP package of the JDoodle for WordPress plugin.
- Upload the JDoodle for WordPress ZIP package at the plugin installation page of your WordPress site.
- Activate the uploaded plugin.
Remark: If you are not familiar with WordPress plugin installation, please have a look at this video tutorial.
Setting up the plugins
Setup the Enlighter plugin to use the Legacy shortcode system. you can set this up using below steps.
- Go to your WordPress site administration.
- In the menu on the left, click Enlighter. This will open the settings page of the Enlighter plugin.
- Click on the Editing tab.
- Scroll down to the Shortcodes panel.
- In the Processor dropdown box, select the option Legacy (WordPress based).
- save changes.
- To start with, you need an account with https://www.jdoodle.com. It is free, you can login with your google account or register with JDoodle by clicking the SignIn button at the top right corner.
- Then you can add your code snippet in https://www.jdoodle.com by visiting the relavent language page, save it and don't forget to mark it as shared.
- Then go back to your WP site editor, press the button called "JDoodle".
- Copy the Shared URL, NOT THE Embed URL.
- Enter a caption for the popup window (Optional).
- Click OK and the shortcode will be generated for you.
If your preference is writing shortcodes directly, write them as follows:
[jdoodle url="your code snippet SHARED URL" caption="your caption"]
Note: The parameter caption is optional.