Can't set language for code fences in Ghost 2.0

I’m trying to use syntax like this:

var foo = "bar"

But in the new Ghost 2.0 editor it switches modes to a code block as soon as I type the third back tick. Is there a way to disable this, or provide the language through some other means?

In the meantime I can fall back to HTML, but would be nice to see if there’s a better workaround.

1 Like

@subdigital correct, the language selection feature isn’t built into the code card at present. Rather than using a HTML card you could use the markdown card which does support the syntax you want to use

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

As of Ghost 2.22.0 it’s now possible to set the language when using fenced code blocks…

```lang+Enter will set the language immediately when creating the code card or you can use the language input inside the code card once it’s created.