shivaprasadks / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

How to use Go language support with self serving #334

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
We are serving our own prettify.js and code-pretty.css, and simply appended the 
Go language support to the end of prettify.js.

However, when we use it:

<pre class="prettyprint lang-go linenums">... // go code here ...</pre>

It is not styled and colored. Any ideas?

Original issue reported on code.google.com by i...@nodesocket.com on 27 Feb 2014 at 2:24

GoogleCodeExporter commented 8 years ago
Do you ever call prettyPrint as described at 
https://code.google.com/p/google-code-prettify/wiki/GettingStarted#Serving_your_
own_JS_&_CSS ?

Original comment by mikesamuel@gmail.com on 27 Feb 2014 at 3:55

GoogleCodeExporter commented 8 years ago
Yes, we do call prettyPrint(). Rhe default/built-in languages work and 
highlight (Python/PHP/Javascript) just not the added language Go.

Original comment by i...@nodesocket.com on 27 Feb 2014 at 8:52

GoogleCodeExporter commented 8 years ago
Can you post a standalone HTML example?  Also, what rules do you use in your 
code-pretty.css

Original comment by mikesamuel@gmail.com on 27 Feb 2014 at 9:37

GoogleCodeExporter commented 8 years ago
Sure, here is a JS fiddle of exactly what I am doing (js and csss): 
http://jsfiddle.net/f9rQ9/

Notice that I simply added the Go language support to the bottom of the 
JavaScript. However, I don't think JSFiddle likes that prettyify.js injects 
html.

Original comment by i...@nodesocket.com on 28 Feb 2014 at 12:24

GoogleCodeExporter commented 8 years ago
Here is a screenshot of what I currently see: http://i.imgur.com/1bKAYJr.png

Original comment by i...@nodesocket.com on 28 Feb 2014 at 12:28

GoogleCodeExporter commented 8 years ago
Any update on this? Would love to have go pigmenting working.

Original comment by i...@nodesocket.com on 7 Apr 2014 at 9:53

GoogleCodeExporter commented 8 years ago
I added a call to prettyPrint at the end and it seems to work.  
http://jsfiddle.net/fJjwB/1/

Note that the go language handler included at the end only styles comments.

Original comment by mikesamuel@gmail.com on 7 Apr 2014 at 11:27

GoogleCodeExporter commented 8 years ago
Ahh so go is not fully supported with colored keywords, strings, functions, etc?

Original comment by i...@nodesocket.com on 8 Apr 2014 at 12:25

GoogleCodeExporter commented 8 years ago
https://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-go.j
s#28

On Thursday, July 22, 2010, Mike Samuel <...> wrote:
> On Thu, Jul 22, 2010, Rob 'Commander' Pike <...> wrote:
>> Personally, I would vote for the subdued style godoc presents at 
http://golang.org
>>
>> Not as fancy as some like, but a case can be made it's the official style.
>> If people want more colors, I wouldn't fight too hard, in the interest of
>> encouragement through familiarity, but even then I would ask to shy away
>> from technicolor starbursts.
>
> Like http://golang.org/pkg/go/scanner/ where comments are blue and all
> other content is black?  I can do that.

It looks like since that was written things have gotten a bit more colorful on 
golang.org.

Original comment by mikesamuel@gmail.com on 8 Apr 2014 at 2:12

GoogleCodeExporter commented 8 years ago
SInce go has gone with more colors, can we get an updated lang-go.js?

Thanks.

Original comment by i...@nodesocket.com on 10 Apr 2014 at 8:15