Code Formatting/Highlights for GWT Group Postings?

2,596 views
Skip to first unread message

Joseph Lust

unread,
May 3, 2012, 10:40:18 AM5/3/12
to google-we...@googlegroups.com
I've seen a few examples of contextually formatted and highlighted code submitted for questions/responses. I was curious how one achieves this in Google Groups as I've seen no facilities for it. Thx.


Sincerely,
Joseph

Brandon Donnelson

unread,
May 8, 2012, 5:24:27 PM5/8/12
to google-we...@googlegroups.com
Do you mean like this below?


public class DatePickerEnhanced extends DatePicker {
    public static DatePickerEnhanced newInstance() {
        DefaultMonthSelector monthSelector = new DefaultMonthSelector();
        CalendarView view = new DefaultCalendarView();
        CalendarModel model = new CalendarModel();
        return new DatePickerEnhanced(monthSelector, view, model);
    }

    public DatePickerEnhanced() {
        super(new DefaultMonthSelector(), new DefaultCalendarView(), new CalendarModel());
    }

    public DatePickerEnhanced(DefaultMonthSelector monthSelector, CalendarView view, CalendarModel model) {
        super(monthSelector, view, model);
    }

    public CalendarView getCalendarView() {
        return getView();
    }
}


Joseph Lust

unread,
May 10, 2012, 11:08:08 AM5/10/12
to google-we...@googlegroups.com
Why yes Brandon,

That is exactly what I fancy. I was hoping that given the heavy usage of GoogleCode, they'd add a <code> tag to their editor here, but alas, no such luck. What is your formatter of choice that works well with these forums?

Sincerely,
Joseph

Brandon Donnelson

unread,
May 10, 2012, 11:38:01 AM5/10/12
to google-we...@googlegroups.com
I agree with you, I'd love to see some function like that. I like the code tag.

What I find works best is using Google Code to render the code in html then I copy and paste it here. I've also done this from google sites, but I like they grey background and code style better when its copied from Google code. Copy and pasting from eclipse really bites b/c it double spaces everything. And for being a group all about source, it would really make sense to add some kind of code formatting. 

http://code.google.com/p/gwt-examples/wiki/TestWikiStuff - this is my playground for copy pasting here. 

I think the next best option is paste your code and then select it and hit code format button at the top of this input window. I could see clean up formatting and add the correct formatting for code. 

Have a good day,
Brandon Donnelson


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/o3CAQK7Hs-cJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Joseph Lust

unread,
Jun 17, 2012, 11:50:16 AM6/17/12
to google-we...@googlegroups.com
After using a comment panel in Brian's GoogleGroups for a while to format my posts, and spamming Brian, I've discovered and easier way to format you code for presenting to the GWT posse.

  1. Open up any posting/issue/wiki page in GitHub, like this one.
  2. Paste your code in and surround with ```<languageName><yourCode>```
  3. Click preview and copy and paste into your GWT Groups posting.
Example Input:
```scala
object pingpong extends Application {
  val pong = new Pong
  val ping = new Ping(100000, pong)
  ping.start
  pong.start
}
```

Example Output:
object pingpong extends Application {
  val pong = new Pong
  val ping = new Ping(100000, pong)
  ping.start
  pong.start
}


Perhaps we can put a sticky about this under posting on the group since we get unformatted code posting that are quite difficult to read all the time.

Sincerely,
Joseph

Brandon Donnelson

unread,
Jun 17, 2012, 5:08:29 PM6/17/12
to google-we...@googlegroups.com
Nice work. 

One other way to format in github sntax with out enclosing follow with two spaces+ and then triple tick.


```java
public void static main(String[] args) {}..

By the way, this might interest you too > http://c.dart-examples.com/reference/gadgets I've created a Google Gadget for gists. 


Have a good day,
Brandon Donnelson



Sincerely,
Joseph

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Jens

unread,
Jul 19, 2012, 1:37:35 PM7/19/12
to google-we...@googlegroups.com

Huu...just found "Markdown Here" @ https://chrome.google.com/webstore/detail/elifhakcjgalahccnjkneoccemfahfoa

After you have installed it you can write Github-flavoured Markdown into any Textarea ( = Google Groups, Gmail, ...) and then right click into the TextArea and choose "Markdown Toggle" to make it look pretty :-)

public static void main(String[] args) {
  System.out.println("Thats awesome!");
}

-- J.

Joseph Lust

unread,
Jul 19, 2012, 5:40:19 PM7/19/12
to google-we...@googlegroups.com
I think my daily visits to GitHub just dropped 90%. Thanks!


Joe

Joe Corneli

unread,
Nov 6, 2016, 10:24:31 AM11/6/16
to GWT Users
Thanks Jens and Joseph -- useful tips!

I wanted to add: "Markdown Here" is also available for Firefox:
https://addons.mozilla.org/en-GB/firefox/addon/markdown-here/
Reply all
Reply to author
Forward
0 new messages