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

Close #8: math rendering #9

Merged
merged 22 commits into from
Jul 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
- run: npm run validate
- run: npm run build

- name: Deploy on push
if: ${{ github.event_name == 'push' }}
- name: Deploy on push to main branch
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.js.map
/node_modules
/test/js
/test/browsertest/js
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### 🚀 Try the [quizdown live editor](https://bonartm.github.io/quizdown-live-editor/)

- supports markdown text formatting, images and syntax highlighting.
- supports markdown text formatting, images, syntax highlighting and math rendering.
- different [quiz-types](./docs/syntax.md): single-choice, multiple-choice, sequence.
- support for [hints and explanations](./docs/syntax.md#hints-and-comments).
- [options](./docs/options.md) for color theme, question shuffling, localization.
Expand Down Expand Up @@ -35,6 +35,21 @@ Add the library to your website and initialize with default options:
</head>
```

To keep the bundle size low, syntax highlighting and math rendering are implemented in separate extensions that can be loaded and registered manually if needed:

```html
<head>
...
<script src="./build/quizdown.js"></script>
<script src="./build/extensions/quizdownKatex.js"></script>
<script src="./build/extensions/quizdownHighlight.js"></script>
<script>
quizdown.register(quizdownKatex).register(quizdownHighlight).init();
</script>
...
</head>
```

Write questions within a `quizdown` class (edit in the [🚀quizdown editor](https://bonartm.github.io/quizdown-live-editor/?code=---%0Aprimary_color%3A%20steelblue%0Ashuffle_questions%3A%20false%0Ashuffle_answers%3A%20true%0A---%0A%0A%23%23%23%20Select%20your%20superpowers!%0A%0A-%20%5B%20%5D%20Enhanced%20Strength%0A-%20%5B%20%5D%20Levitation%0A-%20%5Bx%5D%20Shapeshifting%0A%0A%23%23%23%20What%27s%20the%20capital%20of%20Germany%3F%0A%0A%3E%20Hint%3A%20The%20_largest_%20city%20in%20Germany...%0A%0A1.%20%5Bx%5D%20Berlin%0A1.%20%5B%20%5D%20Frankfurt%0A1.%20%5B%20%5D%20Paris%0A1.%20%5B%20%5D%20Cologne)):

```html
Expand Down
142 changes: 123 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
"author": "Malte Bonart",
"license": "MIT",
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-commonjs": "^19.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"@tsconfig/svelte": "^1.0.10",
"@types/marked": "^2.0.3",
"acorn": "^8.2.4",
"css-tree": "^1.1.3",
"dotenv-cli": "^4.0.0",
Expand All @@ -60,7 +61,8 @@
"auto-bind": "^4.0.0",
"dompurify": "^2.2.6",
"highlight.js": "^10.7.0",
"marked": "^2.0.0",
"katex": "^0.13.11",
"marked": "^2.1.3",
"strip-indent": "^3.0.0",
"svelte-i18n": "^3.3.9",
"yaml": "2.0.0-5"
Expand Down
1 change: 1 addition & 0 deletions public/build/extensions/quizdownHighlight.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/build/extensions/quizdownKatex.js

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions public/build/quizdown.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion public/build/quizdown.js.map

This file was deleted.

36 changes: 33 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@

<title>Quizdown Demo Page</title>

<script src='build/quizdown.js'></script>
<script>quizdown.init();</script>
<script src="./build/quizdown.js"></script>
<script src="./build/extensions/quizdownKatex.js"></script>
<script src="./build/extensions/quizdownHighlight.js"></script>
<script>
quizdown.register(quizdownKatex).register(quizdownHighlight).init();
</script>
</head>

<style>
Expand All @@ -30,9 +34,35 @@ <h1>Quizdown Demo Page</h1>

---
shuffle_answers: true
shuffle_questions: true
shuffle_questions: false
---

#### What's the value of $x$?

This is what i mean:
$$
x=\sqrt{\frac{9}{16}}
$$

> Also check out $\sqrt{x+2}$!

1. [x] Try out: $x=0.75$
1. [ ] $x=0.5$ could also *be correct*!
1. [ ] perhaps $x=1$?
1. [ ] $x=1.5$

#### What's the value of `x[3]`?

```python
# a python list
x = [1, 2, 3, 4]
```

1. [ ] 1
1. [ ] 2
1. [ ] 3
1. [x] 4

#### Who is the person in the picture?

![](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Sir_Tim_Berners-Lee.jpg/330px-Sir_Tim_Berners-Lee.jpg)
Expand Down