FAQ
Hi!

The Go playground is a really great way to share code, but sometimes it's a
little difficult to read. I wonder how difficult it would be to add
automatic syntax highlighting?

Solarized light would probably be one of the more pleasant colour schemes
that keeps closest to the current color scheme.

Cheers,
Torrance

--

Search Discussions

  • Andrey mirtchovski at Oct 25, 2012 at 1:49 am
    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.

    --
  • Bryanturley at Oct 26, 2012 at 10:28 pm
    I don't think you can change text color of individual characters inside a
    <textarea>.
    Assuming it is using a textarea...
    Also I only ever use simple html so maybe someone else knows some voodoo.
    Maybe copy/paste or a download button so you can open it in your own editor
    would be better?

    On Wednesday, October 24, 2012 8:49:55 PM UTC-5, aam wrote:

    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.
    --
  • Herbert Fischer at Oct 26, 2012 at 6:41 pm
    tour.google.com has syntax highlighting.

    Usually I prefer to use the tour instead of "play" just because of this.
    On Fri, Oct 26, 2012 at 4:28 PM, bryanturley wrote:

    I don't think you can change text color of individual characters inside a
    <textarea>.
    Assuming it is using a textarea...
    Also I only ever use simple html so maybe someone else knows some voodoo.
    Maybe copy/paste or a download button so you can open it in your own
    editor would be better?


    On Wednesday, October 24, 2012 8:49:55 PM UTC-5, aam wrote:

    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.
    --

    --
  • Rob Pike at Oct 26, 2012 at 6:52 pm
    Gofmt was written to reduce the number of pointless discussions about
    code formatting. It succeeded admirably. I'm sad to say it had no
    effect whatsoever on the number of pointless discussions about syntax
    highlighting, or as I prefer to call it, spitzensparken
    blinkelichtzen.

    One step at a time.

    -rob

    --
  • Luzon83 at Oct 27, 2012 at 8:54 pm

    On Friday, October 26, 2012 8:46:02 PM UTC+2, Rob Pike wrote:
    Gofmt was written to reduce the number of pointless discussions about
    code formatting. It succeeded admirably. I'm sad to say it had no
    effect whatsoever on the number of pointless discussions about syntax
    highlighting

    It might be worth adding a syntax highlighting directive to Go, where the
    programmer can declare which color schemes certain code sections are best
    viewed with, e.g.

    #theme "ArabianNights"
    package main
    // ...

    #theme "BirdsOfParadise"
    func main() {
    }

    'gofmt -v' would automatically insert the right ANSI terminal color escape
    sequences into the source code to make it visually appealing. This might be
    material for a future Go++.

    --
  • Christoph Hack at Oct 27, 2012 at 9:11 pm

    On Saturday, October 27, 2012 10:54:35 PM UTC+2, luz...@gmail.com wrote:

    'gofmt -v' would automatically insert the right ANSI terminal color escape
    sequences into the source code to make it visually appealing. This might be
    material for a future Go++.
    We should also convert all .go files to .gox files. This files are
    basically .go files inside a zip container, but they have the advantage
    that programmers can embed their preferred font files that are needed for
    the highlighting directly in the source files and we also can expand the
    format later (for example, it might also be a good idea to include some
    color profiles for different output devices). All those changes would
    ensure that the viewing experience of Go code is as pleasing as possible.

    --
  • Thomas Bushnell, BSG at Oct 27, 2012 at 10:08 pm
    Or even better, .goxy files, which add to that a more Java-like syntax and
    automatic conversion from an exception syntax into panic with json-encoded
    strings and also generic syntax. Of course the result is so unwieldy that
    you need an eclipse-like IDE to keep track of everything, which will need
    another layer of "gen" metadata to hold information about generic
    dependencies.

    It seems a lot, but I think with the resulting .goxygen files we will
    finally be able to breathe easier.

    Thomas
    On Oct 27, 2012 2:11 PM, "Christoph Hack" wrote:
    On Saturday, October 27, 2012 10:54:35 PM UTC+2, luz...@gmail.com wrote:

    'gofmt -v' would automatically insert the right ANSI terminal color
    escape sequences into the source code to make it visually appealing. This
    might be material for a future Go++.
    We should also convert all .go files to .gox files. This files are
    basically .go files inside a zip container, but they have the advantage
    that programmers can embed their preferred font files that are needed for
    the highlighting directly in the source files and we also can expand the
    format later (for example, it might also be a good idea to include some
    color profiles for different output devices). All those changes would
    ensure that the viewing experience of Go code is as pleasing as possible.

    --

    --
  • Jackie Li at Oct 27, 2012 at 10:06 pm
    I think I get the joke!
    On Sat, Oct 27, 2012 at 11:02 PM, Thomas Bushnell, BSG wrote:

    Or even better, .goxy files, which add to that a more Java-like syntax and
    automatic conversion from an exception syntax into panic with json-encoded
    strings and also generic syntax. Of course the result is so unwieldy that
    you need an eclipse-like IDE to keep track of everything, which will need
    another layer of "gen" metadata to hold information about generic
    dependencies.

    It seems a lot, but I think with the resulting .goxygen files we will
    finally be able to breathe easier.

    Thomas
    On Oct 27, 2012 2:11 PM, "Christoph Hack" wrote:
    On Saturday, October 27, 2012 10:54:35 PM UTC+2, luz...@gmail.com wrote:

    'gofmt -v' would automatically insert the right ANSI terminal color
    escape sequences into the source code to make it visually appealing. This
    might be material for a future Go++.
    We should also convert all .go files to .gox files. This files are
    basically .go files inside a zip container, but they have the advantage
    that programmers can embed their preferred font files that are needed for
    the highlighting directly in the source files and we also can expand the
    format later (for example, it might also be a good idea to include some
    color profiles for different output devices). All those changes would
    ensure that the viewing experience of Go code is as pleasing as possible.

    --

    --



    --
    Jackie

    --
  • Rob Pike at Oct 28, 2012 at 5:08 am
    Syntax highlighting is juvenile. When I was a child, I was taught
    arithmetic using colored rods
    (http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I
    use monochromatic numerals.

    -rob

    --
  • Si guy at Oct 28, 2012 at 7:28 am
    The most relavent highlight for me is making all := declarations another color, mainly because I'm very farsighted and sometimes I miss the little colon even with glasses on. I think SH has importance to other people with poor vision as well, as an accessibility feature. Color schemes aren't important as long as they're high contrast.

    Making my font huge isn't always an option.

    --
  • Job van der Zwan at Oct 28, 2012 at 9:58 am

    On Sunday, 28 October 2012 08:28:43 UTC+1, si guy wrote:
    The most relavent highlight for me is making all := declarations another
    color, mainly because I'm very farsighted and sometimes I miss the little
    colon even with glasses on. I think SH has importance to other people with
    poor vision as well, as an accessibility feature. Color schemes aren't
    important as long as they're high contrast.

    Making my font huge isn't always an option.
    I second the := and = distinction. Also, being able to immediately see when
    I forgot a closing " or ` or ' is great. What I like about SH in general is
    the ability to help me spot basic patterns like this. What I dislike (and
    what I suppose simply weighs heavier for its detractors) is how it can add
    cognitive load to my reading process. That's probably also why the opposite
    is true for me when it comes to contrast in SH colour schemes: I love
    zenburn for it's low-contrast. And I'm red-green colourblind, so it's extra
    low-contrast for me.

    ... as an aside, I'm kind of curious now if automated syntax highlighting
    is doable for natural languages (subject/object/verb, that sort of thing)
    and what it would look like.

    --
  • Bryanturley at Oct 28, 2012 at 8:38 am

    On Sunday, October 28, 2012 12:09:06 AM UTC-5, Rob Pike wrote:
    Syntax highlighting is juvenile. When I was a child, I was taught
    arithmetic using colored rods
    (http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I
    use monochromatic numerals.

    -rob
    I agree, you kids need to get off our monochromatic grass.

    Best golang-nuts thread ever ;)


    --
  • Thomas Bushnell, BSG at Oct 28, 2012 at 4:35 pm
    I loved Cuisenaire rods! Wow, haven't thought about them in like 35
    years....
    On Oct 28, 2012 6:08 AM, "Rob Pike" wrote:

    Syntax highlighting is juvenile. When I was a child, I was taught
    arithmetic using colored rods
    (http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I
    use monochromatic numerals.

    -rob
    --
  • Ingo Oeser at Oct 28, 2012 at 9:03 pm
    If you are just working with beautifully engineered code in a few languages and grammars, most of it written by your own or at least to your standards, I agree.

    My own use case has always been crappy "commercial grade" code written with IDEs and terminals of 200 glyphs wide. Heavy use of ifdef at multiple levels and stuff like code embedded in other languages code (e.g. templates) are the norm.

    Add DSLs and the meriad of unix config file languages to the mix and I will proudly confess, that I don't know all those grammars well enough and don't even want to. So I let my editor identify things like keywords, bad white space (Makefiles, Python, shell), strings, escape sequences, comment paragraphs, embedded code fragments in templates and ifdefed out code.

    Found many bugs directly after opening the editor while more senior people stared hours at it.

    Call me retarded idiot, but it just saved me and my colleagues a lot of time during the last 25 years of coding :-)

    --
  • Bugpowder at Oct 29, 2012 at 4:27 pm
    On Sunday, October 28, 2012 7:09:06 AM UTC+2, Rob Pike wrote:

    Syntax highlighting is juvenile. When I was a child, I was taught
    arithmetic using colored rods (
    http://en.wikipedia.org/wiki/Cuisenaire_rods). I grew up and today I
    use monochromatic numerals.

    Yes, and we should all use Acme --or, wait, isn't mouse chording juvenile
    too?

    When I was a child, I used programming editors with mouse actions. I grew
    up and today I use Emacs.

    Different strokes for different folks is what I'm getting at.

    Plus, in a field where 3 out of 4 large software projects fail to deliver
    on time or at all, we can use all the contextual help we can from our
    editors.

    --
  • DisposaBoy at Oct 26, 2012 at 7:46 pm

    On Friday, October 26, 2012 7:42:03 PM UTC+1, Herbert G. Fischer wrote:
    tour.google.com has syntax highlighting.

    Usually I prefer to use the tour instead of "play" just because of this.
    Why not just use a proper text editor?

    On Fri, Oct 26, 2012 at 4:28 PM, bryanturley <bryan...@gmail.com<javascript:>
    wrote:
    I don't think you can change text color of individual characters inside a
    <textarea>.
    Assuming it is using a textarea...
    Also I only ever use simple html so maybe someone else knows some voodoo.
    Maybe copy/paste or a download button so you can open it in your own
    editor would be better?


    On Wednesday, October 24, 2012 8:49:55 PM UTC-5, aam wrote:

    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.
    --

    --
  • Bryanturley at Oct 26, 2012 at 9:11 pm
    Might also be a good idea to get used to not using syntax highlighting.
    If I couldn't read code without highlighting I would see that as a problem,
    to each his own though.
    Before anyone responds in anger, I use syntax highlighting most of the
    time.
    I was not saying don't use syntax highlighting, just don't rely on it.

    --
  • Herbert Fischer at Oct 28, 2012 at 4:02 pm
    I do. I was just giving a choice to the person who opened this thread.
    Sometimes when I want to try something quick, I use the tour, just some
    sort of "interactive mode".
    On Fri, Oct 26, 2012 at 4:46 PM, DisposaBoy wrote:


    On Friday, October 26, 2012 7:42:03 PM UTC+1, Herbert G. Fischer wrote:

    tour.google.com has syntax highlighting.

    Usually I prefer to use the tour instead of "play" just because of this.
    Why not just use a proper text editor?

    On Fri, Oct 26, 2012 at 4:28 PM, bryanturley wrote:

    I don't think you can change text color of individual characters inside
    a <textarea>.
    Assuming it is using a textarea...
    Also I only ever use simple html so maybe someone else knows some voodoo.
    Maybe copy/paste or a download button so you can open it in your own
    editor would be better?


    On Wednesday, October 24, 2012 8:49:55 PM UTC-5, aam wrote:

    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.
    --

    --
    --
  • Francesc Campoy Flores at Oct 26, 2012 at 8:03 pm
    Hi Herbert,

    tour.google.com? Did you mean maybe tour.golang.org?

    But as far as I can see there's not syntax highlighting there either.

    Cheers,
    Francesc
    On Fri, Oct 26, 2012 at 11:41 AM, Herbert Fischer wrote:

    tour.google.com has syntax highlighting.

    Usually I prefer to use the tour instead of "play" just because of this.

    On Fri, Oct 26, 2012 at 4:28 PM, bryanturley wrote:

    I don't think you can change text color of individual characters inside a
    <textarea>.
    Assuming it is using a textarea...
    Also I only ever use simple html so maybe someone else knows some voodoo.
    Maybe copy/paste or a download button so you can open it in your own
    editor would be better?


    On Wednesday, October 24, 2012 8:49:55 PM UTC-5, aam wrote:

    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.
    --

    --



    --
    --
    Francesc

    --
  • Christoph Hack at Oct 26, 2012 at 11:35 pm

    On Friday, October 26, 2012 9:11:49 PM UTC+2, Francesc Campoy Flores wrote:

    But as far as I can see there's not syntax highlighting there either.
    There is, but it's optional and disabled by default (because of popular
    demand). You can activate it in the drop-down menu to the right of the run
    button.

    -christoph

    --
  • Francesc Campoy Flores at Oct 26, 2012 at 9:39 pm
    Thanks, I didn't notice that before!
    On Fri, Oct 26, 2012 at 12:30 PM, Christoph Hack wrote:
    On Friday, October 26, 2012 9:11:49 PM UTC+2, Francesc Campoy Flores wrote:

    But as far as I can see there's not syntax highlighting there either.
    There is, but it's optional and disabled by default (because of popular
    demand). You can activate it in the drop-down menu to the right of the run
    button.

    -christoph

    --



    --
    --
    Francesc

    --
  • Lucio at Oct 28, 2012 at 2:05 pm
    It wasn't there before, you might have last looked before it was added,
    quite recently.
    On Friday, 26 October 2012 23:39:36 UTC+2, Francesc Campoy Flores wrote:

    Thanks, I didn't notice that before!

    On Fri, Oct 26, 2012 at 12:30 PM, Christoph Hack <tux...@gmail.com<javascript:>
    wrote:
    On Friday, October 26, 2012 9:11:49 PM UTC+2, Francesc Campoy Flores
    wrote:
    But as far as I can see there's not syntax highlighting there either.
    There is, but it's optional and disabled by default (because of popular
    demand). You can activate it in the drop-down menu to the right of the run
    button.

    -christoph

    --



    --
    --
    Francesc
    --
  • Herbert Fischer at Oct 28, 2012 at 4:03 pm
    Yeah. Sorry for the the "autocomplete" of my tablet... :)

    Just click in the arrow right to the "RUN" button and you will see.

    On Fri, Oct 26, 2012 at 5:11 PM, Francesc Campoy Flores
    wrote:
    Hi Herbert,

    tour.google.com? Did you mean maybe tour.golang.org?

    But as far as I can see there's not syntax highlighting there either.

    Cheers,
    Francesc

    On Fri, Oct 26, 2012 at 11:41 AM, Herbert Fischer <
    herbert.fischer@gmail.com> wrote:
    tour.google.com has syntax highlighting.

    Usually I prefer to use the tour instead of "play" just because of this.

    On Fri, Oct 26, 2012 at 4:28 PM, bryanturley wrote:

    I don't think you can change text color of individual characters inside
    a <textarea>.
    Assuming it is using a textarea...
    Also I only ever use simple html so maybe someone else knows some voodoo.
    Maybe copy/paste or a download button so you can open it in your own
    editor would be better?


    On Wednesday, October 24, 2012 8:49:55 PM UTC-5, aam wrote:

    but sometimes it's a little difficult to read.
    the only time i find the playground difficult to read is right after
    i've stared at the sun too much. don't do that if you're in my
    situation and you'll be fine.
    --

    --



    --
    --
    Francesc
    --
  • Herbert Fischer at Oct 28, 2012 at 4:13 pm
    After reading this thread I suppose "syntax highlighting" is too mainstream.

    Better to use text mode without ANSI colors then. ;)

    --
  • Stevewang at Oct 29, 2012 at 4:57 pm
    Well, this is a topic on which people will never reach consensus.
    So I prefer to look for my favorite editors rather than fight over it.
    On Thursday, October 25, 2012 8:04:42 AM UTC+8, Torrance Hodgson wrote:

    Hi!

    The Go playground is a really great way to share code, but sometimes it's
    a little difficult to read. I wonder how difficult it would be to add
    automatic syntax highlighting?

    Solarized light would probably be one of the more pleasant colour schemes
    that keeps closest to the current color scheme.

    Cheers,
    Torrance
    --
  • Bryanturley at Oct 29, 2012 at 5:33 pm

    On Monday, October 29, 2012 11:57:56 AM UTC-5, stevewang wrote:
    Well, this is a topic on which people will never reach consensus.
    So I prefer to look for my favorite editors rather than fight over it.
    The New Holy War
    Syntax Highlighting on http://play.golang.org.


    --
  • Minux at Oct 29, 2012 at 5:33 pm

    On Tue, Oct 30, 2012 at 1:05 AM, bryanturley wrote:
    On Monday, October 29, 2012 11:57:56 AM UTC-5, stevewang wrote:

    Well, this is a topic on which people will never reach consensus.
    So I prefer to look for my favorite editors rather than fight over it.
    The New Holy War
    Syntax Highlighting on http://play.golang.org.
    I'm just about to say i regret the Go authors don't specify a canonical
    syntax
    highlighting scheme for Go, and then I realize that they did specific one,
    which
    is: no syntax highlighting at all -- just look at gofmt's output and you
    will know
    that.

    --
  • Rob Pike at Oct 29, 2012 at 6:39 pm
    When I was a child, I used to speak like a child, think like a child,
    reason like a child; when I became a man, I did away with childish
    things.

    -rob

    --
  • Joe Farro at Oct 30, 2012 at 1:21 am
    Looks to me like your remark was designed to be degrading. Pure and simple.
    This sort of approach fosters an attitude of arrogance and intolerance in
    the community. This is very unfortunate considering you're such an
    influential member.
    On Monday, October 29, 2012 1:36:42 PM UTC-4, Rob Pike wrote:

    When I was a child, I used to speak like a child, think like a child,
    reason like a child; when I became a man, I did away with childish
    things.

    -rob
    --
  • Jonathan Langevin at Oct 30, 2012 at 1:51 am
    It keeps the theme of his prior comment regarding Cuisenaire rods.
    At least it's consistent with his other replies :-)
    On Mon, Oct 29, 2012 at 9:21 PM, Joe Farro wrote:

    Looks to me like your remark was designed to be degrading. Pure and
    simple. This sort of approach fosters an attitude of arrogance and
    intolerance in the community. This is very unfortunate considering you're
    such an influential member.
    On Monday, October 29, 2012 1:36:42 PM UTC-4, Rob Pike wrote:

    When I was a child, I used to speak like a child, think like a child,
    reason like a child; when I became a man, I did away with childish
    things.

    -rob
    --

    --
  • Rob Pike at Oct 30, 2012 at 1:53 am
    Hey, I was quoting the Bible. If that's degrading, I guess I'm done.

    -rob

    --
  • Patrick Mylund Nielsen at Oct 30, 2012 at 1:58 am
    Looks to me like your remark was designed to be degrading. Pure and
    simple. This sort of approach fosters an attitude of arrogance and
    intolerance in the community. This is very unfortunate considering you're
    such an influential member.

    I hope you don't use Linux. At least he didn't make remarks about monkeys
    doing stuff to themselves.

    If Jesus rose from the grave and told me syntax highlighting was an
    abomination, I would still use it. Doesn't matter if somebody with a
    Wikipedia page frowns on its use. It makes it easier for me to write
    programs. You don't need everybody else to agree. EOD.
    On Tue, Oct 30, 2012 at 2:53 AM, Rob Pike wrote:

    Hey, I was quoting the Bible. If that's degrading, I guess I'm done.

    -rob

    --

    --
  • Bryanturley at Oct 30, 2012 at 3:04 am
    Looks like you hit a nerve. I wonder what color it was...

    --
  • Patrick Mylund Nielsen at Oct 30, 2012 at 3:26 am
    Just hoping people will make up their own mind about what they want to use.
    If arguments from authority were all that important, we'd all be browsing
    the web using smtp and wget.
    On Tue, Oct 30, 2012 at 4:04 AM, bryanturley wrote:

    Looks like you hit a nerve. I wonder what color it was...

    --

    --
  • Martin Wright at Oct 30, 2012 at 9:49 am
    Quoting the bible is generally done to disparage the morality of others by
    deluded, simple-minded, bigots who think that the contemptible rubbish it
    contains is the fount of all wisdom. You obviously didn't understand that.
    On Tuesday, 30 October 2012 01:53:40 UTC, Rob Pike wrote:

    Hey, I was quoting the Bible. If that's degrading, I guess I'm done.

    -rob
    --
  • Tim Harig at Oct 30, 2012 at 3:28 am

    On Mon, Oct 29, 2012 at 06:21:53PM -0700, Joe Farro wrote:
    Looks to me like your remark was designed to be degrading. Pure and simple.
    This sort of approach fosters an attitude of arrogance and intolerance in
    the community. This is very unfortunate considering you're such an
    influential member.
    Yes, his comments where meant to be degrading -- no matter what their
    source and original context. I, approaching my 40th year, am truly
    a child compared to the venerable Mr. Pike. The statements say more
    about his age than they do about mine. Far from being insulted, I am
    a little depressed that a giant such as Mr. Pike has reached an age
    when he dismisses ideas, less from their merit, than based on his own
    long-ingrained habits and nostalgia.

    As for the subject of syntax highlighting, I suspect that most of use
    syntax highlighting in our editors. It is not a question of necessity,
    it just makes reading code more pleasant. Then again, since the site in
    question require opening a web browser window, I often avoid reading code
    placed on the go playground. Maybe someday when I have a little time,
    I will write an extension that pulls the codes from the playground and
    embeds it back into the e-mail body. Then I can syntax highlight it as
    I wish.

    --
  • Dustin at Oct 30, 2012 at 3:41 am
    On Monday, October 29, 2012 8:28:28 PM UTC-7, Tim Harig wrote:

    Yes, his comments where meant to be degrading -- no matter what their
    source and original context. I, approaching my 40th year, am truly
    a child compared to the venerable Mr. Pike. The statements say more
    about his age than they do about mine. Far from being insulted, I am
    a little depressed that a giant such as Mr. Pike has reached an age
    when he dismisses ideas, less from their merit, than based on his own
    long-ingrained habits and nostalgia.
    I'm neither insulted by the color of his jackets nor his web sites. I
    failed to see the part of the thread where he said you can't make your own
    software and put your own colors on it. Otherwise, you're having an
    emotional response to someone's unwillingness to paint something he made
    and gave to the world colors you find favorable.

    In less time than I spent trying to find the "mute this discussion"
    button, I could've written a colorizing/code running pastebin, but like
    most people in this thread, I don't actually care enough about the topic to
    make something better.

    --
  • Tim Harig at Oct 30, 2012 at 4:54 am

    On Mon, Oct 29, 2012 at 08:41:02PM -0700, Dustin wrote:

    On Monday, October 29, 2012 8:28:28 PM UTC-7, Tim Harig wrote:
    software and put your own colors on it. Otherwise, you're having an
    emotional response to someone's unwillingness to paint something he made
    and gave to the world colors you find favorable.
    As I indicated in my post, I don't use the website or others like it.
    I avoid it as much as possible and indicated that I may write software
    so I don't even have to visit it to see code that is posted there from
    this list. As such, I really do not care whether the site has syntax
    highlighting or not.

    --
  • Andrey mirtchovski at Oct 30, 2012 at 3:43 am

    Maybe someday when I have a little time,
    I will write an extension that pulls the codes from the playground and
    embeds it back into the e-mail body. Then I can syntax highlight it as
    I wish.
    ... after you make sure you strip the original syntax highlighting
    embedded in the HTML.

    here's how the golang "hello world" looks on one of those fancy paste sites:

    import <span class='string string_quoted string_quoted_double
    string_quoted_double_ruby'>&quot;fmt&quot;</span>

    func main() {<span class='meta meta_syntax meta_syntax_ruby
    meta_syntax_ruby_start-block'></span>
    fmt.<span class='variable variable_other variable_other_constant
    variable_other_constant_ruby'>Println</span>(<span class='string
    string_quoted string_quoted_double
    string_quoted_double_ruby'>&quot;Hello, playground&quot;</span>)
    }

    even clicking the 'raw' button doesn't help much. the resulting html
    renders without fanciness, but is still not very parseable:

    package main<br/><br/>import &quot;fmt&quot;<br/><br/>func main()
    {<br/> fmt.Println(&quot;Hello, playground&quot;)<br/>}<br/>

    clicking 'download' results in a file with a .rb extension saved
    somewhere on my computer. because ruby's is the default color
    highlighting scheme for that particular site, why not assume that if i
    hadn't chosen anything then i, of course, have chosen ruby?

    --
  • Tim Harig at Oct 30, 2012 at 4:36 am

    On Mon, Oct 29, 2012 at 09:43:16PM -0600, andrey mirtchovski wrote:
    Maybe someday when I have a little time,
    I will write an extension that pulls the codes from the playground and
    embeds it back into the e-mail body. Then I can syntax highlight it as
    I wish.
    import <span class='string string_quoted string_quoted_double
    string_quoted_double_ruby'>&quot;fmt&quot;</span>

    func main() {<span class='meta meta_syntax meta_syntax_ruby
    meta_syntax_ruby_start-block'></span>
    fmt.<span class='variable variable_other variable_other_constant
    variable_other_constant_ruby'>Println</span>(<span class='string
    string_quoted string_quoted_double
    string_quoted_double_ruby'>&quot;Hello, playground&quot;</span>)
    }

    even clicking the 'raw' button doesn't help much. the resulting html
    renders without fanciness, but is still not very parseable:
    Actually, I don't think that would be so difficult as long as the markup is
    well formed. A simple state machine can be used to extract data that
    is not inside of tags. The standard lib has UnescapeString() for removing
    the entities. Some care might need to be used for dealing with line breaks
    and other whitespace but, it isn't nearly as large of a problem as it might
    be a language like Python that is so white space sensitive.

    --
  • Ross Salas at Oct 30, 2012 at 4:07 am
    this Go community is small enough as it is... I'm setting down some rules
    to keep a tighter community...

    no discussion about:
    religion
    politics
    syntax hilighting

    EOD (I just learned that TLA tonight)

    Let's stay focused guys...

    --
  • Aram Hăvărneanu at Oct 30, 2012 at 8:37 am

    I suspect that most of use
    syntax highlighting in our editors. It is not a question of necessity,
    it just makes reading code more pleasant.
    I'm sure crack makes life more "pleasant" as well. That's no argument.

    --
    Aram Hăvărneanu

    --
  • Andrew Gerrand at Oct 30, 2012 at 9:59 am

    On 30 October 2012 14:27, Tim Harig wrote:
    On Mon, Oct 29, 2012 at 06:21:53PM -0700, Joe Farro wrote:
    Looks to me like your remark was designed to be degrading. Pure and simple.
    This sort of approach fosters an attitude of arrogance and intolerance in
    the community. This is very unfortunate considering you're such an
    influential member.
    Yes, his comments where meant to be degrading -- no matter what their
    source and original context.
    It's obvious to me that Rob was just riffing on the "When I was a
    child" refrain that recurred a few times in this thread. I thought it
    was kind of funny, and it's not like the thread was going anywhere.
    Nothing new has been said here.
    As for the subject of syntax highlighting, I suspect that most of use
    syntax highlighting in our editors. It is not a question of necessity,
    it just makes reading code more pleasant.
    For you, sure. Others find it distracting. It's all about personal taste.
    Then again, since the site in
    question require opening a web browser window, I often avoid reading code
    placed on the go playground.
    Your views on opening browser windows surely put you in a smaller
    minority group than Rob's views on syntax highlighting. Furthermore,
    if you don't even USE the playground then why are you posting
    inflammatory messages to this thread? Just for fun?

    For the record: Christoph Hack said he was going to prepare a change
    to restore the more sophisticated editor to the playground. This would
    include a syntax highlighting option that defaults to "off" (as per
    the tour). If this change can be made without any regressions then it
    will be accepted.

    Now, can we please stop talking about this?

    Andrew

    --
  • Mattn at Oct 30, 2012 at 3:21 am
    How about using Google Code Prettify?

    For example: http://jsdo.it/mattn/jqSr

    But, it is applied for static element not textarea. So when you click the
    code, it should replace it to textarea.
    On Thursday, October 25, 2012 9:04:42 AM UTC+9, Torrance Hodgson wrote:

    Hi!

    The Go playground is a really great way to share code, but sometimes it's
    a little difficult to read. I wonder how difficult it would be to add
    automatic syntax highlighting?

    Solarized light would probably be one of the more pleasant colour schemes
    that keeps closest to the current color scheme.

    Cheers,
    Torrance
    --

Related Discussions

People

Translate

site design / logo © 2019 Grokbase