有没有办法格式化这样的 HTTP 请求,就像使用http
markdown 时一样?
PATCH /v1/something/1234 HTTP/1.1
Host: somehost.com
Content-Type: application/json
Accept: application/json
Api-Key: supersecretkey
Content-Length: 107
{
"date": "2023-03-15 05:39",
"status": 0
}
答案1
您可以使用包minted
。Pygemtize 支持词法分析器http
。您可以使用以下命令进行检查:pygmentize -L lexers
。
\usepackage{minted}
\begin{minted}{http}
PATCH /v1/something/1234 HTTP/1.1
Host: somehost.com
Content-Type: application/json
Accept: application/json
Api-Key: supersecretkey
Content-Length: 107
\end{minted}
\begin{minted}[]{js}
{
"date": "2023-03-15 05:39",
"status": 0
}
\end{minted}