Languages
[Edit]
EN

Markdown - how to make blocks of TypeScript code (syntax highlighting - github, dev.to, stackoverflow)

3 points
Created by:
evangeline
390

In this article, we would like to show you how to create blocks of TypeScript code with syntax highlighting in markdown.

To create a block of TypeScript code with syntax highlighting you need to wrap your code with three backticks (```) and tell markdown it's typescript in the first line right after backticks.

Note: You can also type ts instead of whole typescript word.

Practical example:

```typescript
let array = [
    {
        id : 1,
        group : 'Juices',
        items : [
            { name : 'Apple',   price : 1.4 },
            { name : 'Orange',  price : 1.7 }
        ]
    }
];
```

Result from github.com:

Markdown - highlighted TypeScript code example on github.com

Result from dev.to:

Markdown - highlighted TypeScript code example
Markdown - highlighted TypeScript code example on dev.to

 Result from stackoverflow.com:

Markdown - highlighted TypeScript code example on stackoverflow.com

Alternative titles

  1. TypeScript - add syntax highlighting for my code in markdown
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Markdown

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join