Hi this is a pretty basic question for some, but when I copy and paste code from Visual Studio Code the formatting is lost. Can someone help me on the best way to provide samples of code in topics and replies to maintain the formatting?
Hello @Billb. Here’s how you can format code
const x = 5;
You can use the three backticks to start a code block and another set of three backticks to end it and then paste your code snippet in it.
This is `inline` code sample
Becomes:
This is inline
code sample
```
This is block code sample
```
Becomes:
This is block code sample
You can also find the buttons to format your post in the editor you’re writing your text in
Thanks everyone for the reply - this will make it a lot more useful to show code in topics and replies.
Don’t forget also add what langauge it is
```TS
// this is typescript
const x:Array<string> = [1,y as string];
```
Becomes
// this is typescript
const x:Array<string> = [1,y as string];
For JavaScript start with
```JS
2 Likes