Code highlight and HTML insertion

Hello, I’m trying to use prism code highlight with Ghost(pro).

I tried by using this solution (inserting your code block with HTML) which works (it does highlight) but with two problems.

First problem:

The HTML code inside block is not rendered as text.

Second problem:

Generated code starts at line 2, not line 1

Is there another way do accomplish line highlight in Ghost? :cold_sweat:

@muZk that other solution is quite out of date. If you type ``` and press Enter (the rich-text editor supports most of markdown ;-) ) then you’ll get a code card where you can paste code and choose a language.

For the highlighting part you’ll still need to adjust your theme to have highlighting.

https://ghost.org/tutorials/code-syntax-highlighting/

1 Like

Your concern about the count is valid. I updated the post to show you how to fix this.

Basically, you will have to “sandwich” HTML blocks to accomplish the feature. Same code, just different way to implement it.

Let me know if it helps!

1 Like