How to highlight HTTP requests in Github Markdown?
Asked Answered
T

0

10

I'm writing my README.md file for a Github repository, which contains some requisitions written for manual testing the application. The tool I use to make the manual tests is the REST Client extension for VSCode.

I want to show the manual tests highlighted on the front page of the repository, on the README. If it was some javascript, I could write something like:

```javascript
   console.log("Hello World")
```

Github would recognize the code between the ``` and highlight it as javascript. But how can I do it for HTTP headers like these ones?

```http
   ### Expect { message: 'Wellcome to TestsAPI'}
   GET http://localhost:5001/

   ### Expect code 201 and info about the new user
   POST http://localhost:5001/user
   Content-Type: application/json

   {
     "name": "Pitossomo",
     "email": "[email protected]" 
   }
   
   ### Expect code 400
   POST http://localhost:5001/user
   Content-Type: application/json

   { 
     "name": "",
     "email": "" 
   }
   ```

In the example, there are 3 requisitions that can be made my the VSCode REST Client extension, separated by the ###. I put the ```http but it does not work, maybe there is some other word to refer to http headers?

Searching in google I've found the reference for the documentation of Highligh.js, but it does not specifies the word used by Github

Tube answered 27/7, 2022 at 8:53 Comment(3)
You can just specify the http language for the code block exactly as you have shown in your example. Make sure to not indent the block and only use valid HTTP (by e.g. removing the comment and putting out outside the http code block if required). If this didn't work for you, please show what exactly you have entered and how it wasn;t rendered as expected.Allow
As for supported code languages within markdown on GitHub, please refer to the documentation.Allow
@HolgerJust please consider posing your answer as an answer. You'll likely get points for it and then we won't see this as unanswered.K2

© 2022 - 2024 — McMap. All rights reserved.