The 'text' language identifer appears as applescript rather than text

AI-generated summary

The discussion revolves around an issue with the Discourse editor where text highlighted with the “text” language identifier appears as Applescript instead. thristhart initially reported the issue, showcasing identical highlighting despite using different language identifiers.

thristhart also mentioned that omitting the language identifier or setting it to “lang-auto” did not resolve the issue. zchrykng suggested omitting “text” since it defaults to that, but thristhart confirmed that the issue persists.

codinghorror suggested using four-space indentation for pre-formatted text, stating that code fences are meant for source code. However, thristhart explained that the issue arose from a need to indent text eight spaces, which is not easily achievable with the in-editor formatting tools.

The conversation shifted to the limitations of the Discourse editor, with codinghorror suggesting that any decent editor can handle arbitrary spacing depths. thristhart clarified that the goal is to make it easier for users to achieve pretty formatting, not to code in the Discourse editor. Ultimately, thristhart aims to fix the issue themselves, as they believe it is a valid concern that text should not render as Applescript.

```text
Here's some text in the code fence with the text language identifier
```
```applescript
Here's some text in the code fence with the applescript identifier
```
Here's some text in the code fence with the text language identifier
Here's some text in the code fence with the applescript identifier
A screenshot just in case this is a client issue You can see that the blocks are identically highlighted, despite being different language identifiers. Inspecting the block shows that it is incorrectly assigned the class "text applescript" rather than the "text" it should be. This also happens when specifically set to lang-auto.

I have been attempting to figure out where the error happens but I’m not getting anywhere as of yet.

shouldn’t you just omit text since it would default to that?

Unfortunately it happens when text is omitted as well:

here's some text in the code fence with no language identifier

Why don’t you just indent by 4 spaces?

The strong assumption of fences is that THEY ARE FOR SOURCE CODE. (That said, if you explicitly say “none” I agree that should work, but I question why one would bother putting not-source-code in a source code block?)

If you just want pre-formatted text, indent 4 spaces:

here's some text in the code fence with no language identifier

I initially discovered the issue when I was attempting to pre-format a large block of text that I needed to be indented four spaces inside the code block; that is, effectively indented eight spaces. There was no easy way to do that in-editor (other than copy/pasting eight spaces repeatedly) so I tried to use code fences instead.

    the only way to do this is eight spaces
    or via code fence and four spaces

Four spaces is advantageous over eight because I can use the in-editor Preformatted text button to indent large blocks of text by four spaces, but there’s no way to do that with eight. This is obviously not a common use-case, so it’s not a particularly high priority bug.

Any editor worth a damn can indent and unindent blocks of text at will, to arbitrary spacing depths.

The discourse editor can’t :stuck_out_tongue:

Are you coding in the Discourse editor?

No, I was attempting to abuse the code fences to do prettier formatting for a set of Nomic rules. While I don’t mind using vim to do the indentation, I’m more concerned with making it easier for my users to do the pretty formatting, or they won’t bother.

My poor reasons for using the text language specification are irrelevant, though. Text should definitely not render as applescript, which I’m sure you agree with. Still familiarizing myself with the way discourse does highlighting so I can fix it myself, since I’m probably the first person to be bothered by it.

1개의 좋아요