Add Blockquote with auto line numbering

Add Blockquote with auto line numbering

1
data:blog.title
blog code

We know that blockquote is widely used in various blogs and websites. But sometime blogger failed to explain to visitors because of absence of line number. If we can add line number in all shared code then we can indicate the specific line to visitors if they made query. Suppose a user face problem in 22nd line of the shared code but due to absence of line number user have to share the line in comment box but in comment box all the code doesn't support for resisting spam. So if we can add the line number then we can easily refer them that change or alter on specific line.

You would be aware about Blogger new HTML editor that they have added this feature. As a result now we can easily identify the specific line. So I have tried to add this in blockquote. Actually this code build with pure CSS and very easy to add into your blog. So let's proceed to the tutorial.

Live Demo

Step 1 Log in to your Blogger account and Go to your Blogger Dashboard

Step 2 Click on  Now click on -> Template -> Edit HTML-> Unfold code  

Step 3 Now Find this code ]]></b:skin> by pressing Ctrl + F

Step 4 Copy the code from below and Paste it  Before/above ]]></b:skin>


blockquote {
  background-color:#eee;
  font:normal normal 12px/14px "Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;
  color:#444;
  overflow:auto;
  margin:0 0 1em;
  padding:1em;
}
blockquote,
blockquote .line-number {
  /* trick by www.bloggerspice.com Line-height size of the text in the tag <blockquote> and <span class="line-number"> be the same! * /
  font:normal normal 12px/14px "Consolas","Bitstream Vera Sans Mono","Courier New",Courier,monospace !important;
  display:block;
  white-space:pre;
}
 blockquote .line-number {
  float:left;
  margin:-1em 1em -1em -1em;
  text-align:right;
  background-color:#f1f1f1;
  color:#acacac;
  padding:1em .2em 1em .2em;
  border-right:1px solid #e0e0e0;
}
blockquote br {
display:none;
}
 blockquote .line-number span {
  display:block;
  padding:0 .7em 0 1em;
}
 blockquote .cl {
  display:block;
  clear:both;
}
  
Step 5 Now Find this code </body> by pressing Ctrl + F

Step 6 Copy the code from below and Paste it  Before/above </body>

<script type='text/javascript'>
//<![CDATA[
var pre = document.getElementsByTagName('blockquote'),
    pl = pre.length;
for (var i = 0; i < pl; i++) {
    pre[i].innerHTML = '<span class="line-number"></span>' + pre[i].innerHTML + '<span class="cl"></span>';
    var num = pre[i].innerHTML.split(/\n/).length;
    for (var j = 0; j < num; j++) {
        var line_num = pre[i].getElementsByTagName('span')[0];
        line_num.innerHTML += '<span>' + (j+1) + '</span>';
    }
}
//]]>
</script>  

How to use blockquote in blog post?

For applying this Trick just select the code that you want to highlight and Click on quote icon. That's it.

block quote

If you face any problem then feel free to leave a comment below I will help you to install this.
Add Blockquote with auto line numbering
4 Stars stars - "Add Blockquote with auto line numbering" We know that blockquote is widely used in various blogs and websites. But sometime blogger fai...

The is not working on my blog: entangle-pair.blogspot.com all need to number my codes.

Facebook Group Community Disqus Channel Code ConverterHide Code Converter Show EmoticonHide Emoticon

Got questions? Ask ’em below! While we’re here, you might like to give any feedback about this Post, Your comment inspire us to continuous Improvement of This Blog and Contents. Your words are your own, so be nice and helpful if you can. Please, only use your REAL NAME, not your business name or keywords. Using business name or keywords instead of your real name will lead to the comment being deleted. Anonymous commenting is not allowed either. Limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

Make sure you tick the Notify Me box below the comment form to be notified of follow up comments and replies. Thank you for commenting

Contact Form

Name

Email *

Message *