Android Century
  • Home
  • Android Zone
    • Android Apps
    • Android Games
    • Apps APk Files
    • Games Apk Files
    • Apps Hack Tricks
  • Reviews
  • Fantasy Zone
    • Entertainment
    • Quotes and Status
    • Life Style
    • Home Made Tips
    • Hair Care
    • Skin Care
    • Fantasy Tips
  • Tricks
    • Free Recharge
    • Free Internet
    • shopping Cashback
    • Recharge Cashback
  • Tech
  • Mobiles
  • Gadgets
  • News
  • How To's
  • Software
Breaking
Loading...

Featured post

How to Take Great Photos With Apple's iPhone X

Recent Posts

Labels

  • Android Apk Files
  • Android Apps
  • Android Games
  • Apps Apk Files
  • Entertainment
  • Fantasy Tips
  • Gadgets
  • Hair Care
  • HomeMade Tips
  • How To's
  • News
  • Quotes
  • Quotes & Status
  • Recharge Cashback
  • Recharge Promo Codes
  • Shopping Cashback
  • Technology
  • skin care
Home / How To's / How to Add Prism Syntax Highlighter in Blogger blog

How to Add Prism Syntax Highlighter in Blogger blog

Latest Govt. Jobs 10:38:00 How To's Edit
Highlighting code is quite necessary for me since I always add some reference to my codes I provide. This highlighter helps me to explain my code to my readers much effectively, since they highlight the keywords in the code.

I have already posted the article were I have discuss different syntax highlighter and the features they provide. In that article I have highlighted to use prettify and why I had considered to using it because of its ability to highlighter any codes and no extra plugin is required. Since it can highlight any piece of code, therefore the size of code increases, which was around 18KB to 22KB for me including the CSS code. Because it indirectly increases the page size which is bad for Search engine optimization.

Since webpage doesn’t load faster therefore our blogs bounce rate increases and this leads to decrease in page views. I have to use different syntax highlighter which could solve my problem. And then I find this syntax highlighter called Prism.

I have seen many renowned blogger using this plugin to highlight their code. Prism syntax is very different from any other syntax highlighter out there because of it features it provide. I need to highlight code which includes HTML, CSS and JavaScript mainly. If I need any other code to highlight I could simply download that plugin and add to the core code that is already present in that particular page.

That means my plugin by default will only highlight HTML CSS and JavaScript codes. If required some other code language to highlight I can simply add that plugin in that particular page. This methods lead decrease in the size code which is for me 8KB to 9KB including CSS code which is quite low compared to prettify.

So if you are using prettify or any other syntax highlighter I would highly recommend you to shift to Prism right now and decrease your page view.

 How to integrate Prism Syntax Highlighter in your website or blogger?


Make sure to take a backup of your template before proceeding.
Case A: Use this only if you’re main language is other language that of HTML, CSS and JavaScript or you host on Wordpress.

Steps:
  1. Go to this download page and select which themes you want.
  2. Now select which language you want highlight and select which feature you want to add example like line number and line highlighter plugin.
  3. Download JavaScript and CSS code. Add CSS code in your CSS file and add Script in your Head.
  4. Add your code snippets as below.
<pre><code class="language-markup">

</code>
</pre>

Change “markup” to “css” or “javascript” if required.

Case B: If you use HTML, CSS or JavaScript as your main language in web articles or using Blogger Blogs
Steps:
  1. Add this JavaScript just before </body> so that it load last and give more bandwidth for content to load.
    <b:if cond='data:blog.pageType == &quot;item&quot;'>
    <script src='https://blogeutectics.googlecode.com/svn/trunk/prism-eutectics.js'/>
    </b:if>
    
  2. Now you can download any CSS style from this download page.
  3. Add your code snippets as shown below.
<pre><code class="language-markup">

</code>
</pre>
Change “markup” to “css” or “javascript” if required.

 More from Author :


If you are using my prism JavaScript code to install prism them I have included some JavaScript in that script which is quite helpful for your readers. What does this JavaScript do is that it selects the complete code whenever the code snippet that has been highlighted is double clicked. This helps them to copy the complete code very easily. And what does this CSS do that it includes that notification over your code snippets to “Double click” the code to copy. For information check the below image.



If you want add this code manually if you not using my prism code then add this CSS code before ]]></b:skin>
pre{overflow: auto;
padding: 10px;
color: #000;
background: #FCFCFC;
font: 12px/1.5 Monaco,"Courier New",Courier,monospace !important;
white-space: pre-wrap;
width: 90%;
margin: 10px auto;
border-left: 3px solid #6CE083;
padding-left: 13px;}
pre {
    position: relative;
}
pre::after {
content: 'Double click';
padding: 2px 5px;
width: auto;
height: auto;
font-family: monospace;
position: absolute;
right: 8px;
top: 8px;
color: #FFFFFF;
background-color: #A5A5A5;
transition: all 0.3s ease-in-out;
}

pre:hover::after {
    opacity: 0;
    top: -8px;
    visibility: visible;
}
And add this below script above </body> 
<script type='text/javascript'>
//<![CDATA[
for(var pres=document.getElementsByTagName("pre"),i=0;i<pres.length;i++)pres[i].addEventListener("dblclick",function(){var a=getSelection(),b=document.createRange();b.selectNodeContents(this);a.removeAllRanges();a.addRange(b)},!1);
//]]>
</script>
I you face any problem do comment and feel free to ask any doubt.
Thanks for reading.
Share on Facebook Share on Twitter Share on Google Plus

RELATED POSTS


How to Sync Your Contacts Between A...

How to Know a Wi-Fi Network Is Fast...

How to delete your Google search hi...
How to Add Prism Syntax Highlighter in Blogger blog How to Add Prism Syntax Highlighter in Blogger blog Reviewed by Latest Govt. Jobs on 10:38:00 Rating: 5

0 comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments ( Atom )

Search This Blog

TEST BOOK FOR GOVT ENTRANCE TEST

TEST BOOK FOR GOVT ENTRANCE TEST
Find All Latest book for preparation of SSC,RAILWAYBANK PO,RBI,BANK CLERK,GATE ME,GATE CE are available here in less prices, to check out the books click here

Translate

  • Popular Post
  • Random posts
  • Category

Popular Posts

  • Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Refer & Earn Offer:  Hey Guys! Today I make an article about Teen Patti Referral ...
  • Hands-on with the home windows 10 Creators update for the Xbox One: Beam recreation streaming arrives
    The Windows 10 Creators Update is here, now—yes,  now —but not (officially) on the PC. The ...
  • Taotronics TT-BH22 Headphones Review
    We make it a addiction to now not look up pricing of a product sooner than reviewing and if ...
  • Pentagon strongly condemns North Korea missile test
    The Pentagon on Monday strongly condemned North Korea’s latest missile test, adding that the ...
  • Bank wallets growing faster than e-wallets
    In the  bank  versus  e-wallets  sweepstakes,  lenders  have now gained lost ground. As of ...
  • Reliance Jio to offer sharp tariff discounts for customers signing up by March-end
    Reliance Industries' Jio unit will charge a tariff for its services from April, but will offer ...

Random Posts

  • iPad Mini 4 review
    iPad Mini 4 review
    17.03.2017 - 0 Comments
    Apple VERDICT If this was the iPad mini launched alongside the Air 2, it would have been an easy five…
  • Amazon reveals new MOBA-genre game at TwitchCon
    Amazon reveals new MOBA-genre game at TwitchCon
    10.11.2016 - 0 Comments
    Designed for success as a popular livestreamedgame, team action game "Breakaway" is one of three…
  • Freecharge 3G30 – Get Rs 30 Cashback On 3G Recharge Of Rs 100 (All Users)
    Freecharge 3G30 – Get Rs 30 Cashback On 3G Recharge Of Rs 100 (All Users)
    04.04.2016 - 0 Comments
    Freecharge has come up with a new offer. Now get Rs 30 cashback on 3G recharge of Rs 100 or more. This is an…
  • LG V30 2018 model
    LG V30 2018 model
    14.02.2018 - 0 Comments
    NEW DELHI: After Samsung, Asus, Huawei and Nokia, LG too has confirmed its presence at the upcoming…
  • Uber receives itself banned in Italy
    Uber receives itself banned in Italy
    08.04.2017 - 0 Comments
    Uber's difficult year continues: the cab-hailing service has been effectively banned from…

Labels

Android Apk Files Android Apps Android Games Apps Apk Files Apps Hack Tricks Entertainment Free Internet Freecharge Gadgets Games Apk Files How To's Laptops Guide Mobiles Reviews Technology Viral's android zone free recharge

Entertainment

Tricks

Popular Posts

  • Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Refer & ...
  • Steam Now Supports PS4's DualShock 4 Controller
    HIGHLIGHTS ...
  • Lenovo Yoga Book launched in India at Rs 49,990: First Impressions
    Lenovo  has ...
  • This $15 stand turns your Apple Watch into a mini Macintosh
    For all those  ...
  • Grow Hair Faster: How to Make Hair Grow Faster Naturally
    Every woman wants ...
  • MobiKwik - Update E-KYC & Get Rs. 100 Supercash
    MobiKwik - Update E-KYC & Get Rs. 100 Supercash
    Mobikwik - Update ...
  • Fitbit Flex 2017 review
    Fitbit PROS ...

Random Posts

  • This new iPhone 7 case puts Android in the palm of your hand
    This new iPhone 7 case puts Android in the palm of your hand
    17.03.2017 - 0 Comments
    Protecting your iPhone 7 with a case is a smart idea, but what promises to be even smarter is…
  • People want efficient e-governance globally: Survey
    People want efficient e-governance globally: Survey
    27.01.2018 - 0 Comments
    NEW DELHI: Simply having a presence online is not enough; governments must focus on delivering…
  • Asus ROG Zephyrus gaming laptop with ultra-slim form factor launched
    Asus ROG Zephyrus gaming laptop with ultra-slim form factor launched
    24.09.2017 - 0 Comments
    Asus has launched the world’s thinnest gaming laptop, the ROG Zephyrus, in India. The Zephyrus has a…
  • Forget fake news – Facebook wants to use AI to tackle terrorism 2017
    Forget fake news – Facebook wants to use AI to tackle terrorism 2017
    17.02.2017 - 0 Comments
    Facebook's Mark Zuckerberg has posted 5,500 word missive on the social network, in which he discusses…
  • Samsung Pay App Offer 2018: Get 100 Rs Cashback
    Samsung Pay App Offer 2018: Get 100 Rs Cashback
    24.02.2018 - 0 Comments
    Samsung India Pay 100 Rs Cashback Offer: Hey Guys! Today I am going to discuss Samsung Pay App cashback…

Most Popular

  • Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Offer 2018: Refer and Earn Flipkart Vouchers Free
    Teen Patti Refer & ...
  • SAMSUNG GALAXY J7 (2016) REVIEWS
    SAMSUNG GALAXY J7 (2016) REVIEWS
    SAMSUNG GALAXY J ...
  • Top 5 Best SmartPhones under 7000 Rs (March 2017)
    Looking for the ...
  • Apple, IBM, Cisco are huge because of Indians, do not deny them H-1B visa: RBI Governor Urjit Patel
    ...
  • SAMSUNG GALAXY J7 (2016) Specifications
    SAMSUNG GALAXY J ...
  • BlackBerry Teases Marshmallow Beta Testing for Priv by Next Week
    Blackberry ...
  • LG Q6 Review
    LG Q6 Review
    2017 is ...

Contact Form

Name

Email *

Message *

Offers Zone

Created By Android Century Distributed by Android Century
  • Home
  • About us
  • Contact us
  • Privacy policy
  • Terms of use
  • Advertise here
Subscribe Via Email Subscribe To Android Century By Email And Get Free Updates. ;-)


Your email address is safe with us!