Saturday, January 29, 2011

How to Add code snippets to blogger ??

This is my first post with something interesting. Although many such posts exist out there, i made a collection of those to make things easy for myself and the guys out there.

I prefer SyntaxHighlighter, a open source project hosted at code.google.com.Or now hosted at http://alexgorbatchev.com/SyntaxHighlighter/

After you've checked out the the source code, or downloaded a package (Might be outdated, as compared to trunk) from somewhere, its time to add them to blogger.
Its better if you checkout the latest trunk.

Now you need to host the source files somewhere, I am using my google sites  for this job. We can as well use the code.google.com itself, but the directory structure might change in the future, leaving your blog in a bad look.

Anyways getting to the point, there are some javascript (.js) files in the code (See Scripts Folder e.g. shBrushCpp.js etc). Each of this script is for a particular language(Cpp for c++ , vb for visual basic etc), so u might want all of them or just few depending on your needs. Use as minimum as required, as javascript can take some time to load.

Apart from these language specific files, you need to use shCore.js . Also You need the SyntaxHighlighter.css which defines all the classes for our use. and other file clipboard.swf .

Upload these files to your webhost (or google sites for that matter).


Now add the following snippet before </body>  tag. 
Add you domain name to the to the links before moving on.

Example program in c++ ,


int main()
  {
    printf("Hello World !");
    return 0;
  }

13 comments:

  1. Update:

    Apart from the hosting the instructions have changed. See the new hosting site for more info.

    ReplyDelete
    Replies
    1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Projects for CSE.

      Software management seeks for decision support to identify technologies like JavaScript that meet best the goals and characteristics of a software project or improvement programme. JavaScript Training in Chennai Accessible experiences and repositories that effectively guide that technology selection are still lacking.

      Aim of technology domain analysis is to describe the class of context situations (e.g., kinds of JavaScript software projects) in which a software engineering technology JavaScript Training in Chennai can be applied successfully

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Great information I wanted to thank you for this great article. I enjoyed every little bit part of it and I will be waiting for the new updates.
    register domain name

    ReplyDelete
  3. The information you shared through your post is functional. I admire your work. Wish you all the luck for all your blogging efforts.

    dissertation help

    ReplyDelete
  4. great post yaaaaaaaaaaaaaaaaaaaar

    ReplyDelete
  5. Search engine optimization Web pages assertion could help you find information places by demonstrating the favorite internet pages go to the website http://winthecustomer.com/successful-business-marketing-working-together-common-goal/. In the same way, it delivers engagement and interpersonal focus on info, normally of thumb, a little more middle content material, after which deliver the highest quantity of personal hygiene content material.

    ReplyDelete
  6. Assuming you put 24 hours or seven days into learning a language you won't make the following Windows or a new, best in class game. https://hostinglelo.in/

    ReplyDelete
  7. This system guarantees authority in construction and results, it likewise offers a worldview for stewardship in business connections so cooperation can push ahead. It will be urgent that each progression of advancement stake its intrinsic worth to society via consistently clinging to social, natural, and financial boundaries.https://onohosting.com/

    ReplyDelete
  8. In certain settings, clinical coders should make an interpretation of patient diagrams into clinical codes. https://sites.google.com/view/seoservicesindelhiindia

    ReplyDelete
  9. bet365 Casino Review 2021 | €500 Bonus + 300 FS | Vie Casino
    Bet365 Casino offers a comprehensive selection 1xbet korean of slots and table games. We bet365 have m88 analysed and recommended bet365 Casino so that you can have an  Rating: 4 · ‎Review by Vie Casino

    ReplyDelete
  10. Thank a lot. You have done excellent job. I enjoyed your blog . Nice efforts
    If you are looking for the services of web hosting in India or Cheap Web hosting in India do Visit us.

    ReplyDelete
  11. Top Casino and Sportsbook Apps in MI - JTM Hub
    It's great 충주 출장샵 to see online 경상남도 출장샵 sports betting now in 의정부 출장안마 Michigan. The best online 경상북도 출장샵 sportsbook is BetMGM. It's been in 강원도 출장샵 operation since 2006. If you're in a

    ReplyDelete