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


(Tom Shea) #1
```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.


(zchrykng) #2

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


(Tom Shea) #3

Unfortunately it happens when text is omitted as well:

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

(Jeff Atwood) #4

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

(Tom Shea) #5

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.


(Jeff Atwood) #6

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


(Tom Shea) #7

The discourse editor can’t :stuck_out_tongue:


(Jeff Atwood) #8

Are you coding in the Discourse editor?


(Tom Shea) #9

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.