questmark-webrenderer 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +63 -0
- package/README.md +54 -56
- package/dist/main.js +1 -1
- package/dist/webRender-basic.js +1 -1
- package/main.mjs +23 -23
- package/package.json +5 -4
- package/site/index.html +102 -0
- package/webRender-basic.js +62 -62
- package/webpack.config.js +31 -31
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
name: Deploy demo site to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: pages
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout
|
|
23
|
+
uses: actions/checkout@v7
|
|
24
|
+
|
|
25
|
+
- name: Set up Node
|
|
26
|
+
uses: actions/setup-node@v7
|
|
27
|
+
with:
|
|
28
|
+
node-version: 24
|
|
29
|
+
cache: npm
|
|
30
|
+
|
|
31
|
+
- name: Install dependencies
|
|
32
|
+
run: npm install --no-audit --no-fund
|
|
33
|
+
|
|
34
|
+
- name: Build the renderer
|
|
35
|
+
run: npm run build
|
|
36
|
+
|
|
37
|
+
- name: Assemble the site
|
|
38
|
+
run: |
|
|
39
|
+
mkdir -p site-out/demos
|
|
40
|
+
cp -r dist site-out/dist
|
|
41
|
+
cp site/index.html site-out/index.html
|
|
42
|
+
# Serve the example documents from the built renderer in this deploy
|
|
43
|
+
# instead of the published package on unpkg.
|
|
44
|
+
for f in examples/*.md.html; do
|
|
45
|
+
sed 's#https://unpkg.com/questmark-webrenderer@[0-9.]*/dist/#../dist/#g' "$f" > "site-out/demos/$(basename "$f")"
|
|
46
|
+
done
|
|
47
|
+
ls -R site-out
|
|
48
|
+
|
|
49
|
+
- name: Upload Pages artifact
|
|
50
|
+
uses: actions/upload-pages-artifact@v5
|
|
51
|
+
with:
|
|
52
|
+
path: site-out
|
|
53
|
+
|
|
54
|
+
deploy:
|
|
55
|
+
needs: build
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
environment:
|
|
58
|
+
name: github-pages
|
|
59
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
60
|
+
steps:
|
|
61
|
+
- name: Deploy to GitHub Pages
|
|
62
|
+
id: deployment
|
|
63
|
+
uses: actions/deploy-pages@v5
|
package/README.md
CHANGED
|
@@ -1,56 +1,54 @@
|
|
|
1
|
-
# Questmark-Webrenderer
|
|
2
|
-
|
|
3
|
-
This is a simple "inline web renderer and interpreter" for Questmark.
|
|
4
|
-
|
|
5
|
-
It allows you to create "live" Questmark documents that you can easily work on and test in your browser!
|
|
6
|
-
|
|
7
|
-
## Usage
|
|
8
|
-
|
|
9
|
-
1. Save your Questmark document (in Markdown source code form!) as a `.html` file
|
|
10
|
-
2. Add the following lines to the bottom of the file, exactly as shown:
|
|
11
|
-
~~~
|
|
12
|
-
```comment
|
|
13
|
-
<script src="https://unpkg.com/questmark-webrenderer@1.0.7/dist/webRender-basic.js"></script>
|
|
14
|
-
<script src="https://unpkg.com/questmark-webrenderer@1.0.7/dist/main.js" type="module"></script>
|
|
15
|
-
```
|
|
16
|
-
~~~
|
|
17
|
-
3. Open the .html file on your browser!
|
|
18
|
-
|
|
19
|
-
(see [space-alien.md.html](https://github.com/jorisvddonk/questmark-webrenderer/blob/master/examples/space-alien.md.html) ([demo](https://raw.githack.com/jorisvddonk/questmark-webrenderer/main/examples/space-alien.md.html)) for an example)
|
|
20
|
-
|
|
21
|
-
You can also save your Questmark documents as `.md` files, but then you need to open them using a webserver that forces the `text/html` Content-Type header. [local-web-server](https://github.com/lwsjs/local-web-server) can do this using the following config file, for example:
|
|
22
|
-
|
|
23
|
-
```js
|
|
24
|
-
module.exports = {
|
|
25
|
-
mime: {
|
|
26
|
-
'text/html': ['html', 'md']
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
and then run
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx local-web-server --config-file ws_config.js
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## alternative usage
|
|
38
|
-
|
|
39
|
-
Alternatively, you could load a .md file in your browser, open the browser console, and then paste and execute the following:
|
|
40
|
-
|
|
41
|
-
```javascript
|
|
42
|
-
const qm_wr1 = document.createElement('script'); qm_wr1.setAttribute('src', 'https://unpkg.com/questmark-webrenderer@1.0.7/dist/webRender-basic.js');
|
|
43
|
-
const qm_wr2 = document.createElement('script'); qm_wr2.setAttribute('type', 'module'); qm_wr2.setAttribute('src', 'https://unpkg.com/questmark-webrenderer@1.0.7/dist/main.js');
|
|
44
|
-
document.body.appendChild(qm_wr1);
|
|
45
|
-
document.body.appendChild(qm_wr2);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* The VM can be modified prior to it starting, and can be prevented from auto-starting, by setting the global variable `preRun` to a function that receives the `vm` instance. Return `false` from this function to prevent the VM from auto-starting. See [prerun.md.html](https://github.com/jorisvddonk/questmark-webrenderer/blob/master/examples/prerun.md.html) ([demo](https://raw.githack.com/jorisvddonk/questmark-webrenderer/main/examples/prerun.md.html)).
|
|
56
|
-
|
|
1
|
+
# Questmark-Webrenderer
|
|
2
|
+
|
|
3
|
+
This is a simple "inline web renderer and interpreter" for Questmark.
|
|
4
|
+
|
|
5
|
+
It allows you to create "live" Questmark documents that you can easily work on and test in your browser!
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
1. Save your Questmark document (in Markdown source code form!) as a `.html` file
|
|
10
|
+
2. Add the following lines to the bottom of the file, exactly as shown:
|
|
11
|
+
~~~
|
|
12
|
+
```comment
|
|
13
|
+
<script src="https://unpkg.com/questmark-webrenderer@1.0.7/dist/webRender-basic.js"></script>
|
|
14
|
+
<script src="https://unpkg.com/questmark-webrenderer@1.0.7/dist/main.js" type="module"></script>
|
|
15
|
+
```
|
|
16
|
+
~~~
|
|
17
|
+
3. Open the .html file on your browser!
|
|
18
|
+
|
|
19
|
+
(see [space-alien.md.html](https://github.com/jorisvddonk/questmark-webrenderer/blob/master/examples/space-alien.md.html) ([demo](https://raw.githack.com/jorisvddonk/questmark-webrenderer/main/examples/space-alien.md.html)) for an example)
|
|
20
|
+
|
|
21
|
+
You can also save your Questmark documents as `.md` files, but then you need to open them using a webserver that forces the `text/html` Content-Type header. [local-web-server](https://github.com/lwsjs/local-web-server) can do this using the following config file, for example:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
module.exports = {
|
|
25
|
+
mime: {
|
|
26
|
+
'text/html': ['html', 'md']
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
and then run
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx local-web-server --config-file ws_config.js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## alternative usage
|
|
38
|
+
|
|
39
|
+
Alternatively, you could load a .md file in your browser, open the browser console, and then paste and execute the following:
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
const qm_wr1 = document.createElement('script'); qm_wr1.setAttribute('src', 'https://unpkg.com/questmark-webrenderer@1.0.7/dist/webRender-basic.js');
|
|
43
|
+
const qm_wr2 = document.createElement('script'); qm_wr2.setAttribute('type', 'module'); qm_wr2.setAttribute('src', 'https://unpkg.com/questmark-webrenderer@1.0.7/dist/main.js');
|
|
44
|
+
document.body.appendChild(qm_wr1);
|
|
45
|
+
document.body.appendChild(qm_wr2);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Customization
|
|
49
|
+
|
|
50
|
+
You can currently customize the following things:
|
|
51
|
+
|
|
52
|
+
* Extra foreign functions can be supplied to the VM by setting the global variable `extraForeignFunctions` to a JavaScript object, with the keys mapping to foreign functions passed to the VM. See [foreign-function.md.html](https://github.com/jorisvddonk/questmark-webrenderer/blob/master/examples/foreign-function.md.html) ([demo](https://raw.githack.com/jorisvddonk/questmark-webrenderer/main/examples/foreign-function.md.html)) for an example.
|
|
53
|
+
* The VM can be modified prior to it starting, and can be prevented from auto-starting, by setting the global variable `preRun` to a function that receives the `vm` instance. Return `false` from this function to prevent the VM from auto-starting. See [prerun.md.html](https://github.com/jorisvddonk/questmark-webrenderer/blob/master/examples/prerun.md.html) ([demo](https://raw.githack.com/jorisvddonk/questmark-webrenderer/main/examples/prerun.md.html)).
|
|
54
|
+
|