A JavaScript module and CSS file that allows syntax highlighting of source code snippets in an HTML page.
Questions tagged [prettify]
145 questions
1
vote
1 answer
AngularJS: tabbing performance with Google Code Prettify
I've built a simple tabbed code viewer using Google Code Prettify in AngularJS but I'm having an issue with slow performance when clicking through the tabs (as well as when performing other actions).
Here is the relevant plunker:…

damo-s
- 1,008
- 7
- 16
1
vote
1 answer
Always black code with prettify on blogger
I have been trying to set up my blog to integrate code snippets. I tried prettify but it didn't really work.
I have put
in my template's head and…

Mehdi
- 1,370
- 3
- 15
- 26
1
vote
2 answers
Using Prettify on dynamically-generated code
I'm using Prettify for syntax highlighting, but it doesn't work on dynamically generated code.
I have a form that when submitted generates code and displays it (without refreshing) in

eozzy
- 66,048
- 104
- 272
- 428
1
vote
1 answer
Prettify fails to handle less-than in certain circumstances
If I try the following test case with prettify, if doesn't work correctly.
for(int…

paj28
- 2,210
- 3
- 25
- 37
1
vote
1 answer
Using Java Prettify for Android app syntax highlighting
I need to integrate syntax highlighting into my application for Android. I tried using Java Prettify(https://code.google.com/p/java-prettify) but I am failing to integrate it. The app is crashing. And since my avd isnt working, so I cannot get…

Himanshu Jaju
- 1,439
- 1
- 11
- 16
1
vote
2 answers
Angular: how to force a recompile of a block
I am post-processing the output of prettify to highlight some lines in the code. I'm using code like this, which works fine:
x = angular.element('.prettify li:nth-child(' + zz['line'] + ')');
x.css('background-color', 'yellow');
x.prop('title',…

paj28
- 2,210
- 3
- 25
- 37
1
vote
1 answer
Why is white space being added to my prettified pre tag?
When I paste (copied from sublime text) code into a 'contenteditable' pre tag it appears fine. When it's saved to a database, pulled back down and the 'prettyprint' (google-code-prettify) class is added it seems to add a bunch of random spaces.…

Liam McCabe
- 53
- 2
- 8
1
vote
1 answer
Issue running Assemble and Prettify in Grunt
I'm trying to get prettify to run through one directory and prettify the html files into the same directory after Assemble creates the files. When running the default task together, prettify throws an error:
Running "prettify:indent" (prettify)…

GrumpyKitten
- 83
- 1
- 7
1
vote
0 answers
Using prettify on StackOverflow for syntax highlighting code
I just knew that I can syntax highlight code blocks here using Prettify but I don't really get the idea. Somebody edited my other question by highlighting my code but I would like to know how I can do it myself so I can present my code problems in a…

Seong Lee
- 10,314
- 25
- 68
- 106
1
vote
3 answers
prettyPrint() only has an effect once. (google-prettify)
I have this JavaScript (with jQuery):
var g_files_added, socket, cookie, database = null;
var file_contents = [];
function viewFile(key, filename) {
$('#title-filename').text(filename);
$('.prettyprint').text(file_contents[key]);
…

Sam Saint-Pettersen
- 511
- 5
- 21
1
vote
1 answer
How to write an HTML JSON AJAX test harness with prettify, syntax highlighted JSON result?
I've written a JSON API, but I won't be working on the views.
How do I test the JSON API with a simple webpage with prettify, syntax highlighted JSON result?
Let's use the following GET API call as an example:…

sonjz
- 4,870
- 3
- 42
- 60
1
vote
1 answer
Google Prettify cutting my code- need fix
currently I have code that is being cut off at the < in the for loop because the browser treats it as a tag, does anyone have a fix for this?:
int count_simd(char *arr, int len, char key) { int count = 0; __m128i…

TheoretiCAL
- 19,461
- 8
- 43
- 65
1
vote
1 answer
Prettify.JS does not display HTML script tags properly
I'm using Prettify.JS to display some code on a Web site I'm developing. I seem to be having some problems with script tags, especially 'non-linking' ones:
// Link CSS <link rel="stylesheet" href="device.css" /> //…

ObiHill
- 11,448
- 20
- 86
- 135
1
vote
1 answer
Google Prettify with Lex tag Parser Code
It appears Google Prettify doesn't like lex parser tags. I've added the following to a blog post that uses prettify to format code:
{{ widgets:area slug="above-body" }}
{{…

Dan Bough
- 499
- 1
- 10
- 23
1
vote
1 answer
Syntax highlighting of code snippets in a web page "google-code-prettify" not working
I have following code,

Arti Patel
- 313
- 3
- 6
- 15