JavaScript Class Method Chaining
February 10, 2020Ionic 4 Google Maps Tutorial
March 10, 2020Recently I was tasked with updating old blog posts with code in them where you can copy/paste the text and have consistent syntax highlighting. You can post code with no plugin but it looks plain and hard to read.
var person = {
fullName: function() {
return this.firstName + " " + this.lastName;
}
}
I started researching the different WordPress syntax highlighting plugins. As you would expect there were a lot of plugins to choose from. I soon narrowed my options down to two, SyntaxHighlighter Evolved and Code Syntax Block. Here are the pros and cons of both.
SyntaxHighlighter Evolved
Pros
- Up to date
- A lot of downloads
- Easy to use
- Good reviews
Cons
- Looks blocky
- Doesn’t highlight as expected
- Shortlist of compatible languages
Code Syntax Block
Pros
- Up to date
- Good Reviews
- Easy to use
- Looks great
- An extensive list of compatible languages
Cons
- Few downloads
- Only has 5 reviews
I decided to go with Code Syntax Block, so now you can post easy to read good looking code with only a few easy steps.
Choose a new block and set it to code
Once you have chosen the code block you will have the option to select your desired language and give your code block an optional heading.
Now your code will look great.
var person = {
fullName: function() {
return this.firstName + " " + this.lastName;
}
}
var person1 = {
firstName:"John",
lastName: "Doe"
}
var person2 = {
firstName:"Mary",
lastName: "Doe"
}
person.fullName.call(person2); // Will return "Mary Doe"
I highly recommend using a syntax highlighter when incorporating code into your blog posts.