When collaborating on GitHub, clearly showing code changes can enhance communication. A simple way to achieve this is by using diff formatting in your comments. Here’s how:
diff
after the opening triple backticks.-
(minus) and lines to be added with +
(plus).Here’s an example:
```diff
- const oldLine = 'This line will be removed';
+ const newLine = 'This line will be added';
```
This will render as:
- const oldLine = 'This line will be removed';
+ const newLine = 'This line will be added';
Using this method helps visually distinguish additions and deletions in your code, making your comments clearer and more effective.