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
3
votes
1 answer

Google prettify in an offline / localhost application requesting external files

The google prettify is working great for me. I have built an application with a Twitter bootstrap front-end and the google prettify syntax highlighting. But the application is also used for working offline e.g. localhost, so I included the…
Theo
  • 150
  • 11
3
votes
1 answer

google-code-prettify xml indention

I have added line breaks in a generated xml doc. "\n" some text etc."\n" "\n" this should end up as: some text etc. Is this possible with google-code-prettify - or should I do it myself in the code that…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
3
votes
2 answers

Getting google prettify to work with dynamic views blogger template

I have tried this and this , both previous solutions from stack overflow but both of these solutions are not working with Dynamic Views Template of Blogger. Can you please help to get this working.
3
votes
2 answers

Which CDN hosts the Google Code Prettify CSS file?

I've found the JS file on cloudflare, however the CSS file is nowhere to be found. Any ideas ? Note: I don't want to link directly to the SVN repository and I don't want to use dropbox.
Questioner
  • 31
  • 3
3
votes
1 answer

How do I use a prettify.js theme?

There's a set of "themes" for prettify.js. How do I actually use them? Do I to a selected "theme" .css file instead of prettify.css file or do I do anything else? What's the procedure?
sharptooth
  • 167,383
  • 100
  • 513
  • 979
3
votes
4 answers

HTML/JS/CSS syntax highlighter that supports LLVM

I'm currently using google-code-prettify for syntax highlighting. It doesn't seem to support LLVM. Here's what it looks like when formatting LLVM: It's pretty ugly. Are there any front-end syntax highlighters that support LLVM?
jterrace
  • 64,866
  • 22
  • 157
  • 202
3
votes
1 answer

Syntax highlighting of dynamically generated snippet in web page using Prettify

I've a div in which I dynamically load a piece of code from the result of an AJAX request. Then I want to format it using prettify. It works but it's damn slow. The code I use is the following: var jqxhr = $.get(fileName) .success(function(data) { …
2
votes
1 answer

How can I add linenums dynamically to Google Code prettify?

I have this fiddle. I am trying to format some code and am having trouble inserting and removing line numbers dynamically. It seems on the first page load the line numbers appear but once I click run then I can't get them back. On my website they…
2
votes
1 answer

Javascript flavor regex for identifying valid Python strings enclosed within triple quotes

I'm trying to write a Prettify-style syntax highlighter for Qiskit Terra (which closely follows the Python syntax). Apparently, Prettify uses Javascript flavor regex. For instance, /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"' is the regex…
user10648668
2
votes
1 answer

What is the state of the art approach for creating own rules for Google's Prettify?

What is the state of the art approach for creating own rules for Google's Prettify? I am not talking about changing the colors of existing rules, furthermore, I want to create new rules: e.g for shell/bash maybe in an extrem case for a poem, in…
2
votes
1 answer

Guidelines for Google Code Prettify

I'm hoping to pick up Issue 295 from Google's Code-Prettify project; i.e. to add support for lang-powershell. Whilst I've found some code examples, I can't find any documentation on how this code should be written, or any submission guidelines (e.g.…
JohnLBevan
  • 22,735
  • 13
  • 96
  • 178
2
votes
1 answer

Using Google Code Prettify CDN with a custom skin

I'm using the Google Code Prettify CDN link: By design, it appends a CSS stylesheet into the DOM:
brandonscript
  • 68,675
  • 32
  • 163
  • 220
2
votes
1 answer

Where to find the csharp loader for Googles Code Prettify

Im trying to setup a code highlighter for my up coming blog, however... it seems like code prettify has dropped the support for csharp(C#) or they have hidden the loader somewhere else.. any ideas? I just checked out their github repo and cant find…
Inx51
  • 1,911
  • 3
  • 24
  • 44
2
votes
1 answer

Can Prettify.js be used to highlight code on Wikipedia?

I want to add highlighted Mathematica source code to Wikipedia pages, samples of brief apps like those in WR's Tweet-a-Program. Currently, there's good support for Mathematica syntax highlight in prettify.js, and this is what…
andandandand
  • 21,946
  • 60
  • 170
  • 271
2
votes
0 answers

Can't display HTML because of markdown

So I'm using AnchorCMS and using Google code prettify. All languages but HTML work. I've asked this before and I was told to use < and > and so fourth. So I used it, but when I save the post its rendered back into HTML, so the HTML which I'm…
user3444414