I7 highlighting

…Is the forum trying to keyword-highlight I7 code? I can’t say I like the result. This is not how I7 gets formatted in the IDE.

Looking at Travel cost and action cost , for example. The bold text comes off more like a ransom-note cliche than like a surfacing of the I7 code structure.

2 Likes

I’ve never seen that behavior. I’m trying to replicate it but not having success on my phone.

I do notice the tag is ‘code’ in square brackets instead of triple backticks which might format differently.

I posted in this thread ( Parchment for Noobs ) using triple backticks, and got the boldface is.

1 Like

Huh, the HTML looks like this:

<code class="hljs csharp">The Kitchen <span class="hljs-keyword">is</span> a room.

Release along with an interpreter.
</code>

Is Discord trying to auto-recognize the language and coming up with “csharp”?

There is a default style but I’m not up enough on formatting styles. May need to have @DavidG or @Dannii take a peek.

[deleted by author]

2 Likes

This is all quite odd, considering that autohighlighting is turned off, and no languages are meant to be highlighted… I’ll ask at the Discourse forums.

screenshot of settings

1 Like

Thanks for following up.

1 Like

So Discourse said it’s working as intended, and that even though it has changed, the old behaviour must have been buggy. But they told me which settings I could change so that it won’t happen anymore. :slight_smile: The old posts will keep their formatting until either someone edits them or one of the admins here clicks on “rebuild HTML”.

Can it be set up so that by default there’s no highlighting but post authors could choose to apply highlighting if they want? It would be handy mainly for the occasional HTML and Javascript code. You can specify the language in Markdown but it doesn’t have any effect here:

```html
<div> test </div>
```

Result:

<div> test </div>

Highlight.js (that Discourse uses) supports Inform 7 highlighting although not very well, at least to my taste: it highlights too many keywords (“Code is a kind of thing. Code is usually plural-named.”) but maybe someone could improve it and submit a pull request.

Yeah once I figure out how the different settings work together I’ll look at adding Inform 6/7/anything else useful.

Yeah, there’s something fundamentally wrong with the idea of keyword highlighting in I7. I7 doesn’t really have keywords; “is” is usually a linking verb but doesn’t have to be. And even when it is, highlighting linking verbs is a stupid idea! I’d rather highlight the subject:

Code is a kind of thing. Code is usually plural-named.

But syntax highlighters are not remotely capable of this sort of thing. You’d need to pull out most of the I7 compiler’s parser and modify that for syntax markup.

(I’ve wanted that for years in the IDE. The IDE has access to the compiler, of course, so it’s at least a workable idea once the open-source era begins.)

1 Like

You’re talking about different highlighting than I7 already does in the IDE?

Screen Shot 2020-09-29 at 10.42.48 AM

Like if it could call out what it considers objects - like bolding objects, underlining locations etc?

Yes.

The IDE syntax coloring is fine by me. I use similar syntax coloring for I7 code on my web site (https://eblong.com/zarf/zweb/heliopause/Heliopause-src.html), and I also wrote an Atom colorer which is used on Github. That just distinguishes headers, code, comments, strings, string interpolations, and (for the bonus round) I6 inclusions. That’s all pretty easy.

My dream is to use the compiler’s parser to do semantic coloring, ie:

  • Object names (“the lamp”)
  • Object descriptions (“all open containers”)
  • Action descriptions (“taking a lit thing”, “putting something in the box”)
  • Top-level declarations (“The player carries the lamp.”)
  • Rule headings (“Before opening a door:”)
  • Adjectives in descriptions (“open” in “all open containers”)

This would be helpful in sorting out what’s going on when the compiler’s interpretation is unobvious. I.e., the perennial questions about “Before touching something carried by the player for the first time in the Library”. (Not a real example, sorry; I couldn’t find a real example question in a hurry. But that sort of thing.)

The problem with this idea is that these coloring categories form a nested tree! You could write

Before putting something in the open box: ...

So “box” is an object name; “the open box” is an object description; “open” is an adjective; “putting something in the open box” is an action description; the whole line is a rule header. It’s not at all clear how to represent this for the author without drowning them in colored confetti.

Maybe a pop-up tooltip window showing a nested hierarchy. I mean, that’s terrible, but it’s similar to how the developer console of a web browser works when you dig into the DOM.

4 Likes