6

The tag currently doesn't currently support automatic syntax highlighting for GAP code. Could we get this enabled? I've been manually adding <!-- language-all: lang-gap --> to a bunch of posts and now I feel silly. Here's how adding that syntax highlighting affects the code appearance.

## Keywords
       Assert      Info  IsBound      QUIT
TryNextMethod    Unbind      and    atomic
        break  continue       do      elif
         else       end    false        fi
          for  function       if        in
        local       mod      not        od
           or      quit readonly readwrite
          rec    repeat   return      then
         true     until    while

gap> ## An example of using the GAP interpreter
gap> g:= SymmetricGroup( 5 );;
gap> gens:= [ (1,2), (1,2,3,4) ];;
gap> s:= Subgroup( g, gens );;
gap> h:= Group( gens );;
gap> s = h;
true
gap> Parent( s ) = g;
true

1 Answer 1

5

The lang-gap hint doesn't do anything. We don't have syntax highlighting for GAP. All of the supported language hints are listed here; you'll note that GAP isn't on the list. It pretty much includes only the most popular languages.

When you specify lang-gap, you're just getting lang-default, which…is the same thing as what you get by default.

10
  • Oh, well now I still feel silly. Does the default highlighting just know to highlight Capitalized names as functions? (see here for an example post). Jul 8, 2020 at 16:43
  • 1
    Also, the lang-default highlighting is better than nothing. Would it be a bad idea to automatically apply lang-default highlighting to GAP-system tagged questions? Jul 8, 2020 at 16:43
  • Oh rereading your answer, maybe I should say explicitly the default highlighting has been none, not default. Jul 8, 2020 at 16:52
  • 2
    @MikePierce I have written an answer on what lang-default does: meta.stackoverflow.com/a/327677/578411
    – rene
    Jul 8, 2020 at 17:28
  • 1
    You are currently getting none for [gap-system] questions. I can make the [gap-system] tag use default, which works as rene explained. Is that what you want? Do you think that's helpful? Usually we don't do that for unsupported languages, because the effects can be confusing. Sure, capitalized identifiers get automatically detected and highlighted as function names, but there will be lots of other things that are wrong, including comments not getting highlighted, etc. Generally, it's better just to have no highlighting than to have wrong highlighting. @Mike Jul 9, 2020 at 5:56
  • @CodyGray Yeah, I think it would be helpful. I do recognize your concern though. In my limited experience adding lang-gap to a bunch of posts I haven't seen anything horrible go wrong. The GAP syntax isn't strange or novel or anything. It might be confusing that any capitalized word, even non-built in functions, get highlighted though. But gosh having those highlighted helps with reading long lines so much. I've added the list of GAP keywords and a small example to my post so you can see the effects of the default highlighting. Jul 9, 2020 at 14:13
  • 1
    @Mike I'm hesitant to do this on the recommendation of only one user. Are there others who are active in the GAP tag that have an opinion? I'd like to see them weigh in here as well. If we can get any sort of a consensus, it's an easy change, but this is not my area of expertise, so it makes me uncomfortable to just start forcing changes on the community. Jul 10, 2020 at 6:05
  • @CodyGray thanks for looking at this! From what I have seen so far, the default highlighting renders GAP code quite well (@Mike applied it a number of posts already), and it's better with it rather than without any highlighting at all. I think it will be useful if you can apply it automatically to all gap-system questions [I am mostly active at math.stackexchange.com/questions/tagged/gap since most of questions have mathematical content and are asked there - it would be nice to have the default syntax highlighting there too, if possible at all.] Jul 12, 2020 at 22:20
  • What would need to be done to actually teach the system proper gap highlighting? As in, what library/libraries are used to perform the GAP highlighting, so that somebody can submit a PR to them to add it for GAP?
    – Max Horn
    Jul 15, 2020 at 22:50
  • 2
    @Max It's effectively not possible at this point. Stack Overflow uses Google Prettify as its syntax highlighting engine, but Prettify is no longer maintained. Even when it was officially maintained, it never accepted any pull requests from me or others to add languages, and even if it had, SO only used a subset of Prettify's language support and almost never updated. There have been proposals to switch to another highlighting engine, but all rejected for reasons. Jul 16, 2020 at 3:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .