Inline code supposed to work?

Hello, I am having a hard time with in-line code like this.

`like this`

I thought this would work on my blog, but it didn’t. Is there a way to do this easily?
Essentially I would need a inline, as I understand it, but how to do that? It seems that whenever i type some code, it does not pickup on the ` symbol.

Even when I go back to the normal Ghost Casper theme 2.8 and remove any extensions, it still doesn’t work for me.

Note: I already have PrismJs and MathJax added onto my website.

Okay, I found that mathjax by standard has asciimath2jax included, which by standard looks for ` signs, therefore I needed to redefine what it looks for.

But it still leaves me unable to write inline code like this :frowning:

asciimath2jax: {
    delimiters: [['$','$']]

But this
Produces this

The problem I found is that it doesn’t process it and actually add the <code> tag for it.

Are you having trouble entering inline code in the editor or is it only in your theme where you are having issues?

The editor will automatically convert markdown for you as you’re typing which will output This is inline <code>code = 5</code> in the HTML. Here’s a video showing how inline code markdown expansions work in the editor:

My issue is not with the syntax of inline code, but rather that when I type


With code inside those backquotes, it does simply not convert into inline code on my site. When I go look at the specific line where I typed the backquotes, it is just a <p> tag with no <code> tags at all. It seems that it does not place the code tags in there.

No matter if I use the default Casper theme or my own slightly tweaked version and remove all code injection, it does not work.

@MLFromScratch you’re describing a bug with the rich-text editor so no amount of changing themes will help you unless you switch to using a markdown card for your content with inline code.

Can you give me some more details about your environment? OS, browser version, keyboard layout, etc. Are you using a keyboard layout where the ` key is actually a dead key (we’ve seen issues with some german keyboard layouts with that problem but it was fixed)?

Oh okay. So I cannot use the backquotes to get inline code, e.g. if I were to explain some code in between normal text?

As far as I’m aware, my keyboard works as it should. I’m from Denmark, so I have a nordic keyboard layout, but I found the shortcut. Windows 10 version 10.0.17134. Chrome version 71.0.3578.98.
Actually, I am using PrismJs for syntax highlighting and already have created a markdown card with a block of code like this:

# Add two numbers!

# This function adds two numbers 
def add(x, y):
   return x + y


You can if you use a markdown card instead of rich-text.

As far as I’m aware, my keyboard works as it should

I’m not disputing that but different keyboard layouts can have different ways of entering special chars like ` (“grave” / “diacritical grave”) which the editor needs to take into account - it sounds like there’s a bug where the editor is not recognising the way that your ` are being entered.

I have a nordic keyboard layout, but I found the shortcut

Which shortcut is that? Is there a key combination you have to use to type a `?

You can if you use a markdown card instead of rich-text.

Alright, got it. As you said above, I have to use a markdown card for my whole post if I want that feature.

Well it’s easier to just show my main keyboard where I write almost everything. I press shift + the key left from backspace (whatever it is called) to get the sign in the bottom left of that key:

But let me make it clear: I don’t use markdown cards nor want to use them for inline code. Just so we are on the same page here.

@MLFromScratch You’re getting first-class support from Kevin, the person who singlehandedly wrote the entire editor. He’s trying to get enough information from you to fix the bug you’re encountering whilst also offering you a temporary workaround.

I’m not at all unhappy with the support, editor nor anything surrounding the whole Ghost concept! :slight_smile: We all wish for new features, bugs fixed and so on.

Sorry if I seem angry with Kevin, I am not.

Thanks. Unfortunately I’ve not been able to reproduce using a nordic keyboard layout on macOS/Chrome 71 but maybe there’s something different with how Windows handles the grave accent key.

There is a slight difference with how you need to use space or the arrow keys to get the cursor in the right place when using a nordic layout (at least on macOS) but it’s definitely working in my environment.

1 Like

Thanks Kevin.

I just found exactly what the issue was, perhaps this should be noted for others users :slight_smile: I don’t know if I would call it a bug, but it has something to do with how you write the backquotes.

Steps to reproduce the non-working inline code:

  1. Double tap ` key
  2. Click or move using arrow keys into the backquotes
  3. Write code in between backquotes

The issue is that I have always written {}, [], `` and so on by doubling up then actually typing code in there. This also means you cannot copy-paste a piece of code in, you actually have to write it.

The correct way to get it to work:

  1. Single tap ` keyboard (even though it is invisible before hitting the next character)
  2. Type some code
  3. Finish with a single ` and hit space afterwards

Maybe this is how it is supposed to be, though it was not very easy to find out about! Thank you for your help Kevin!

Maybe this is how it is supposed to be, though it was not very easy to find out about!

Interesting. This is how it is supposed to work but it does sound like the nordic keyboard layout / windows is doing something different that makes it harder to visualise. On english/us keyboard layouts (and in my testing with nordic layout on macOS) the ` is shown immediately and you can type or paste as needed with a final ` then converting to an inline <code> element. Typing the final markdown char whether it’s ` for code, ** for bold, or _ for italics is how all of the markdown expansions work in the editor.

The issue is that I have always written {} , [] , `` and so on by doubling up then actually typing code in there.

This won’t work with markdown expansions, you’d have similar problems if you wrote **** then tried writing in the middle of it to have bold text. Typing the final markdown chars is what triggers the expansion - it allows for natural typing for most formatting whilst still allowing exceptions where you really do want text like **IMPORTANT** without struggling with it always being auto-formatted to bold.

Yes it definitely is something with nordic keyboards (or other keyboards than english)! It has always been like this on all keyboards here in Denmark.

I was not necessarily refering to my other work with markdown, but just coding in general. If I had a better and deeper understanding of how markdown works, I’m sure this would have been better understood.

Anyways, thank you for your assistance! My site is ready for all the inline code it can handle now :smiley:

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