Skip to content
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

Allow embedding dot-http in markdown #46

Open
tglman opened this issue Apr 11, 2020 · 2 comments
Open

Allow embedding dot-http in markdown #46

tglman opened this issue Apr 11, 2020 · 2 comments

Comments

@tglman
Copy link
Contributor

tglman commented Apr 11, 2020

Hi,

Did you ever considered to allow to have dot-http scritps embedded as code in markdown ? this would allow to have some documentation together to the script or even write API documentation executable with dot-http.

This may even be a downstream project just looking for an opinion here :)

Regards

@bayne
Copy link
Owner

bayne commented Apr 12, 2020

This sounds interesting and I haven't considered it before. Could you give an example of how you might think this would work? Also is this inspired from something else?

@tglman
Copy link
Contributor Author

tglman commented Apr 12, 2020

Hi,
yes as example you could have a file requests.http.md with a content like:

(is actually hard to do markdown examples in markdown, hope is understandable)

 # My Application API
This is my Application
## Login API
will need a username and password  send by post

` ` `dot-http
POST http://localhost/login
Content-Type: application/json
{"user": "admin", "password", "admin"}
` ` `
# And more with more api ...

when this is run with dot-http the markdown part is completely ignored, or at most some titles could be used in the output to make it more understandable.

In other cases the markdown could be just rendered as html as usual, and the dot-http just displayed as code.

I think it could even be possible to generate some html pages that could manage to trigger the requests somehow (similar to how jupyter notebook works), anyway this case is pretty complex and may need a lot of time to be done compared a basic support of markdown that could be achieved simply using some existing libraries.

Hope this make it more clear

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants