-
Notifications
You must be signed in to change notification settings - Fork 37
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
Embed a working example server #38
Embed a working example server #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you rename options.js
to pug-options.js
to make the purpose more self-evident?
Yup, let me know if you'd like any other changes. |
15e2bed
to
e8f3bbd
Compare
I've gone ahead and fixed the conflict that came about from merging the highlight change. Additionally, I moved code highlighting code to make instead of having it happen on the client. I realized after the fact that the docs are actually pulled from online, so this pull request requires a matching pull request in the main repo to activate the server stuff: koajs/koa#1031 Basically, any example you want to make a server, you just add |
Just wanted to check in to see if there's anything left to do. To recap, the last change:
|
cd3160f
to
0e1d9d4
Compare
I've now also fixed the conflict with the latest change. |
Just checking in on this, anything else needed? |
Any update on this? |
Just checking in again. |
@tolmasky is there any way you could fix the merge conflicts so we can get this merged in? |
0e1d9d4
to
ab41abf
Compare
Reviewed by @tolmasky.
OK, I believe I have now fixed the merge conflicts. To summarize the various changes:
IMPORTANT This change includes the updated |
Another quick note about the IMPORTANT note above. Neither change blocks the other, this one accepted now will simply "degrade" to the old non-live behavior (but keep the performance and version advantages), until the subsequent change on the main Koa repo is taken in. |
merged |
just tested as well on koajs.com, looks good! thanks @tolmasky |
Great, thanks! Do you happen to also have commit privileges for the corresponding commit on the main repo, or should I just bump that myself to get them to take it in? koajs/koa#1031 |
I'd like to propose adding a runnable embedded Koa server into the documentation, to make it easy for people to play around with Koa and see how it works. Basically, both the initial hello world example and the following logging example are completely editable and testable right from the browser, which ends up looking like this:
This is powered by RunKit (which I helped create), which is creating a virtual server on demand behind the scenes. And if for whatever reason RunKit goes down, the example will fall back to just looking as it does now. The goal we are trying to accomplish is to make libraries immediately usable, so people can start programming right from the documentation, not having to first install etc etc.
Lodash has been using RunKit on their documentation for about a year now, and Express recently incorporated RunKit into their Getting Started example as well. https://expressjs.com/en/starter/hello-world.html . Would love to see the same here, and I am happy to make any changes as necessary.
A small note: the change set is a bit larger than it would seem to need because I upgraded jade to pug. The version of jade being used to create these docs was quite old and has since been renamed to pug. I added a "runkit-endpoint" markdown code language that can be used to turn any code snippet into one of these live examples. I'm also happy to make the corresponding documentation commit on Koa's git repo, but wasn't sure how that should be coordinated.