-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for "http" #157
Comments
http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html Here is the RFC, knowing its number might help to find code/library to handle it |
Do you know any formatter that supports http files? I have been thinking about adding a format command for hougesen/hitt, but has refrained from doing so since hitt supports some additional syntax (variables, comments, multiple requests in single file) that could result in breaking other tools. |
I looked for many tools but I failed to I know linguist, the library used by GitHub for code highlighting supports it. But there is no linter in it. The biggest problem is that finding relevant content mentioning http, that's everywhere … it's uneasy Also the http syntax is somehow only used in Markdown I didn't look at AST based project or tree-sitter anyway. I'm dropping buzz words with no knowledge about tree-sitter I found this lib by looking for "tree-sitter-http" https://github.com/rest-nvim/tree-sitter-http This one looks perfect if you understand how to use it, something I don't. There might be something around mardown-it maybe. But I found nothing about markdown-it-http I'm also thinking about VScode extension that allows to find send http headers from http block directly in the markdown preview. They have to parse the content to create the query. I found this one https://github.com/Huachao/vscode-restclient |
I hope my detailed reply will help you. I just opened the hitt project, and noticed it was yours haha. My guess is that would be easy for you to build something. But then, I'm wondering you may found a parser, but you are looking for a formatter. So I'm insure what can be done. You might be able to write a parser, so you might be able to report obvious things like
this one is very common and leads to broken highlighting Except formatting the JSON I'm unsure what you could format, and a few fixes. I'm unsure what you can format Oh I also know sphinx-doc reports invalid blocks when parsing the doc block (because if highlight code), it could be useful to look at what they do |
I hope you will read what I wrote @hougesen 😅🤣😂 Because my investigation took time |
Thank you for investigating! 😃 I read it yesterday, but still haven’t really made up my mind about what to do 😅 I wrote a custom parser for hitt since I wanted full control. So adding formatting abilities is definently an option. Do you use the vs code extension? |
I would say create a lib in a separate repository. Import it in mdsf, you will have support for http block. You might add it to hitt, then maybe. Everyone might have a need for a lib. Maybe @Julien-cpsn will have a need for https://github.com/Julien-cpsn/ATAC Unless I'm wrong your two projects are I'm Rust |
I opened #337 |
Just found There is the httparse crate, it may help |
Possible via https://github.com/mistweaverco/kulala-fmt |
Here is the documentation of an http request
But it's not limited to json replies. It could return HTML/XML
It's a very used pattern in API documentation
The code snippets are badly indented on purpose.
The text was updated successfully, but these errors were encountered: