Questions tagged [google-code-prettify]

Prettify is a JavaScript module and CSS file that allows syntax highlighting of source code snippets in an HTML page.

Google Code Prettify is a JavaScript module and CSS file that allows syntax highlighting of source code snippets in an HTML page.

Features

  • Works on HTML pages
  • Works even if code contains embedded links, line numbers, etc.
  • Simple API: Include some JavaScript code and CSS, and add an onload handler.
  • Lightweight: Small download and does not block page from loading while running.
  • Customizable styles via CSS. See the themes gallery
  • Supports all C-like, Bash-like, and XML-like languages. No need to specify the language
  • Extensible language handlers for other languages. You can specify the language.
  • Widely used with good cross-browser support.
103 questions
2
votes
0 answers

Extra whitespace using google-code-prettify

Hey I have a weird problem, I use the google-code-prettify code to display code on my blog, but somehow the pre tags don't really preserve the whitespace. For some reason, the whitespace is doubled and sometimes tripled when posting, making the code…
Chris
  • 89
  • 1
  • 1
  • 10
2
votes
1 answer

How to add line numbers when using google prettify in the nocode class?

related How to add line numbers to all lines in Google Prettify? I am looking at google's http://code.google.com/p/google-code-prettify/ to display come code I have written in Mathematica inside a web page. Mathematica is not supported language. So,…
Nasser
  • 12,849
  • 6
  • 52
  • 104
2
votes
0 answers

Google prettify,prettyPrint() doesn't work

Today I downloads prettify-4-Mar-2013.tar.bz2.And I use the "prettify.css" and "prettify.js" in it. I know I can use it in an easy way just use the "run_prettify.js", but I want to serve my own JS & CSS. Here's my html.
2
votes
2 answers

Google Code Prettify - stripes/piano keys without line numbers?

I'm using Prettify (from Google Code - https://code.google.com/p/google-code-prettify/). When one adds the linenums attribute then it renders the program using alternating background colors on each line (i.e., it uses "stripes" or "piano keys"). …
MikeTheTall
  • 3,214
  • 4
  • 31
  • 40
2
votes
1 answer

How to fix Google prettify handling of HTML escape sequences

google-code-prettify handles HTML escapes in code blocks by 'prettifying' the escape characters themselves, rather the escaped sequence. For example the: original HTML ... > ... gets prettified…
Remus Rusanu
  • 288,378
  • 40
  • 442
  • 569
2
votes
1 answer

Google Prettify Line numbers and Overflow

When adding overflow to Google prettify elements, the line numbers disappear. Unchanged CSS: pre { font-size:11px; background-color:white; } /* Alternate shading for lines */ li.L1, li.L3, li.L5, li.L7, li.L9 { background: #eee;…
Dan Bough
  • 499
  • 1
  • 10
  • 23
1
vote
1 answer

google-code-prettify doesn't add the classes to SPAN tags for Java code

I'm trying to integrate google-code-prettify to my site in order to prettify Java code. I followed the instructions at http://google-code-prettify.googlecode.com/svn/trunk/README.html. I can verify that I get SPAN elements for the tokens in the code…
Christian Schlichtherle
  • 3,125
  • 1
  • 23
  • 47
1
vote
0 answers

Cannot format javadoc html with google-code-prettify lib

I tried to add styling to a
 block using:
https://github.com/google/code-prettify
But all I see is this:



I am looking to get the default syntax highlighting.
I put this at the top of the html file:
and then I have a 
 block that looks…
user5047085
1
vote
2 answers

problems with google code prettify for printing java code having code like List>

I'm trying to print below line on html page: List> someVar = someMethod(); however, in html Map is being treated as tag in html Below is the output I'm getting: List> someVar = someMethod(); everything else other…
1
vote
3 answers

Google code-prettify Code highlighting not working for Polymer 3

How to use Google code-prettify in Polymer 3? The syntax highlighting is not working. Sample code below: class MyView1 extends PolymerElement { static get template() { return html`
Vikram Rawat
  • 1,472
  • 11
  • 16
1
vote
0 answers

How to use google code-prettify to show diff

I have a an application that can browse out code tree and can show individual source code that are nicely highlighted using google code google code-prettify I want to add a feature that shows diff between version. I have the changes in git-diff…
yigal
  • 3,923
  • 8
  • 37
  • 59
1
vote
1 answer

Dynamic Code Snippet Display In Javascript

I am writing a JS function: showCodeSnippet(fileName) Input: Local File Name Output: Display Code in HTML I know about the security constraints which restrict accessing local files in browser, but managed to create a workaround solution. Please…
Sandeep Singh
  • 4,941
  • 8
  • 36
  • 56
1
vote
1 answer

Markup ommited by Google Code Prettify

In my view I have following piece of code:
    @Model.ArticleText
If ArticleText is just a text containing code syntax, for example: "public ArticlesViewModel() { public string ArticleName {…
wec
  • 11
  • 3
1
vote
1 answer

Using Google Code-Prettify with Typescript and Angular 4

I'm pretty new to using Typescript and Angular 4, and I am having trouble integrating Google Code-Prettify with the angular CLI setup. I am trying to figure out how to import code-prettify to use dynamically with my components, but I am unsure how…
dev_pool
  • 203
  • 4
  • 14
1
vote
1 answer

Google code Prettify code in Angular2 partially working

I am trying to display code in html and prettify it using Google Code prettify. I am almost close to completion of my requirement, but when I try to externalize the file and pull code from it, it isn't working. Here is my ts code…
srk
  • 4,857
  • 12
  • 65
  • 109