waldyrious / rst-playground

Browser-based reStructuredText playground, built on Pyodide and docutils.
https://waldyrious.github.io/rst-playground
ISC License
1 stars 4 forks source link

Display messages if JS or WASM are not enabled #23

Closed not-my-profile closed 1 year ago

not-my-profile commented 1 year ago

The index.html file (yes there is absolutely no reason to use .xhtml^^) should contain sth like:

<noscript>This website requires JavaScript.</noscript>

at the top of the website.

And in the JavaScript code we want to check if typeof WebAssembly === 'object' and otherwise do something like alert("This website requires WebAssembly.").

waldyrious commented 1 year ago

there is absolutely no reason to use .xhtml^^

I like using XHTML as it automatically ensures the document is well-formed without having to set up a separate testing infrastructure (which is still valuable otherwise). Since it fails loudly, it's basically impossible for small errors to creep in over time.

As for the topic of the issue, yes, 100% agree on both counts. I'll mark this as ready since you've already provided guidance on how to address it.

Alessandro-Battiato commented 1 year ago

Hello! :) This is my first time ever contributing to a project in order to solve an issue, but I wanted to be sure I'm understanding everything correctly and thus why I'm asking you, aside from adding the javascript warning requirement inside the xhtml file which is absolutely an easy task, I wanted to know what exactly is this WebAssembly? I checked the script.js code but I can't find it anywhere, I don't know if it's anything that should be obvious and I'm just too ignorant to understand That's all, if I'm able to solve the second issue as well I would then kindly ask you if it's possible to assign me the issue and I'll work on it immediately :)

not-my-profile commented 1 year ago

Hello :)

If you're unfamiliar with some technology, Wikipedia is often a good starting point: WebAssembly. For web technologies in particular the MDN Web Docs from Mozilla are a great resource: WebAssembly.

You are correct to note that you cannot directly find WebAssembly anywhere in the script.js code, that is because our dependency on WebAssembly is indirect through the Pyodide library. The Pyodide website says:

Pyodide is a Python distribution for the browser and Node.js based on WebAssembly.

It's great that you're starting out with contributing! Don't be afraid to ask questions in general :) Software projects often contain much context that isn't directly documented. In this case I think your question highlighted that my suggested message "This website requires WebAssembly." could be improved to "This website requires WebAssembly because it depends on Pyodide to run docutils in the browser.".

It's not necessary to be assigned on issue in order to work on it, but I am sure @waldyrious will assign you once he reads this :)

waldyrious commented 1 year ago

Thanks @Alessandro-Battiato for offering to help! As @not-my-profile said, issue assignment is not necessary for contributing. You can just go ahead and pick up whatever task you feel like working on! (I suppose formal assignment is useful in large projects with lots of contributors and frequent changes, to make sure people don't step over each other, but that's definitely not the case here 🙂) That said, I'll assign you nevertheless since you asked for it. Looking forward to seeing your contribution!

Alessandro-Battiato commented 1 year ago

Thanks to both of you! :) I just completed the Pull request, I'm obviously open to constructive criticism, please do tell me if I could have solved the issue in a different and better way! Have a nice day :)