DEV Community

loading...

Discussion on: How to Write Your First Post on DEV

Collapse
gochev profile image
Nayden Gochev

Nice post,
however to me it is not clear how to add highlight for the code template ?

Screenshot from your post

By default in Markdown you can write with 3 ` the begining of a code block and the end with 3 ` however also at the beginning you can write the language for highlight which doesnt seems to work.

Example of markdown with highlight not in dev.to but in general :

```javascript
console.log("this should be highlighted with javascript but this is not the case);
```

So can you explain how to paste a code block WITH a highlight intext in the post.

Collapse
chrisachard profile image
Chris Achard Author • Edited

... oh weird! I just wrote this comment about how it should work, but then it didn't for me... I'm looking into it; not sure what's going on

Collapse
chrisachard profile image
Chris Achard Author

Ah! Got it - if I have a backtick (just a single one) in the post like you do BEFORE the three backticks, then the parser gets confused... try just doing threebackticks with the "javascript" and it should show up like this:

console.log("this should be highlighted with javascript but this is not the case);

Does that work for you?

Thread Thread
gochev profile image
Nayden Gochev • Edited

We should add this to the markdown ? btw when writing post :))

Sometimes it looks it doesnt work .. its weird but now it works.. :) weird !

```javascript
console.log("no color");
```

now in the post I have `*3 times but here bellow when trying I am typing just 3 times without SPACES and I got it !

console.log("test JavaScript");

weird why it wasn't working above.

System.out.println("test again Java ");
Console.WriteLine("whoo c# has to be lowercase c");
Forem Open with the Forem app