Merge branch 'main' into fpliger/69_add_makefile

This commit is contained in:
Fabio Pliger
2022-05-05 13:55:05 -05:00
3 changed files with 12 additions and 11 deletions

View File

@@ -5,9 +5,9 @@ This page will guide you through getting started with PyScript.
## Development setup
PyScript does not require any development environment other
than a web browser. We recommend using Chrome.
than a web browser. We recommend using [Chrome](https://www.google.com/chrome/).
If you're using [VSCode](https://code.visualstudio.com/) the
If you're using [VSCode](https://code.visualstudio.com/), the
[Live Server extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)
can be used to reload the page as you edit the HTML file.
@@ -16,16 +16,16 @@ can be used to reload the page as you edit the HTML file.
There is no installation required. In this document we'll use
the PyScript assets served on https://pyscript.net.
If you want to download the source and build it yourself follow
If you want to download the source and build it yourself, follow
the instructions in the README.md file.
## Your first PyScript HTML file
Here's a "Hello, world!" example using PyScript
Here's a "Hello, world!" example using PyScript.
Using your favorite editor create a new file called `hello.html` in
the same directory as your PyScript JavaScript and CSS files with the
following content and open the file in your web browser. You can typically
the same directory as your PyScript, JavaScript, and CSS files with the
following content, and open the file in your web browser. You can typically
open an HTML by double clicking it in your file explorer.
```html
@@ -124,7 +124,8 @@ HTML head. You can also link to `.whl` files directly on disk like in our [toga
</py-env>
```
If your `.whl` is not a pure Python wheel then open a PR or issue with [pyodide](https://github.com/pyodide/pyodide) to get it added here https://github.com/pyodide/pyodide/tree/main/packages. If there's enough popular demand the pyodide team will likely work on supporting your package, regardless things will likely move faster if you make the PR and consult with the team to get unblocked.
If your `.whl` is not a pure Python wheel, then open a PR or issue with [pyodide](https://github.com/pyodide/pyodide) to get it added [here](https://github.com/pyodide/pyodide/tree/main/packages).
If there's enough popular demand the pyodide team will likely work on supporting your package, regardless things will likely move faster if you make the PR and consult with the team to get unblocked.
For example, NumPy and Matplotlib are available. Notice here we're using `<py-script output="plot">`
as a shortcut, which takes the expression on the last line of the script and runs `pyscript.write('plot', fig)`.

View File

@@ -2,7 +2,7 @@
## What is PyScript
### tl;dr
### Summary
PyScript is a Pythonic alternative to Scratch, JSFiddle or other "easy to use" programming frameworks, making the web a friendly, hackable, place where anyone can author interesting and interactive applications.
To get started see [GETTING-STARTED](GETTING-STARTED.md).

View File

@@ -4,11 +4,11 @@ function addClasses(element: HTMLElement, classes: Array<string>) {
}
}
const getLastPath = function (str) {
function getLastPath(str: string): string {
return str.split('\\').pop().split('/').pop();
};
}
function htmlDecode(input) {
function htmlDecode(input: string): string {
const doc = new DOMParser().parseFromString(ltrim(input), 'text/html');
return doc.documentElement.textContent;
}