Luv33preet
Luv33preet

Reputation: 1867

customizing code snippets in markdown

I want to achieve something like this,

enter image description here

This is a screenshot from some digital ocean tutorial.

I want some colored variables using markdown in code snippets AND that header in which the file name is appearing. Is it possible ? If yes, then how ?

Upvotes: 1

Views: 1183

Answers (1)

user8122577
user8122577

Reputation:

You can use tables containing inline code snippets.

In GitHub markdown:

| My Code                   |
|:-------------------------:|
| `int main() { return 0; }`| 

Renders as: preview

I hope this answered your question!

EDIT: There is also syntax highlighting, like YAML. To do that, you add the language after the ticks like so:

```bash
$ echo "hello world"
```

That will render as: syntax highlighting

Edit 2: Here is the link for the supported language highlighting keywords: https://github.com/github/linguist/blob/master/lib/linguist/languages.yml

Upvotes: 2

Related Questions