quizdown-extended-live-editor
v0.1.0
Published
Local live editor for Quizdown-Extended markdown quizzes with Monaco + Vite
Downloads
9
Readme
Quizdown Extended Live Editor
A Vite + React + TypeScript live editor for Quizdown-Extended markdown quizzes. Monaco on the left, quizdown-extended + Shiki preview on the right.
Install & run from npm
Global install (recommended):
npm install -g quizdown-extended-live-editor
quizdown-editor --quizzes ./quizzes --port 4173--quizzes(optional) sets the directory where your markdown quizzes are read/written. Defaults to./quizzes(created if missing).--port(optional) defaults to4173.- The npm package never ships user quizzes;
public/quizzesis excluded from publish.
Once running, open the printed URL and use the UI to create/save files. Keyboard: ⌘/Ctrl+S saves.
Local development (from repo)
npm install
npm run devThe dev server runs on port 4173 and enables the /__quiz-editor/* endpoints for file operations against public/quizzes (repo-local).
How it works
- App shell:
src/App.tsxmanages theme, file list, active file, pane split, and buttons wired to the editor ref (save,appendQuestion). - Editor:
src/components/Quiz/QuizMarkdownEditor.tsxlazy-loads Monaco, fetches/__quiz-editor/quizzes/<file>, trackslatestValue, handlesCmd/Ctrl+S, and uses customgithub-light/github-darkMonaco themes. - Preview:
src/components/Quiz/QuizComponent.tsxrenders with quizdown-extended, registers Shiki languages (Python + local Robot grammar), choosesgithub-light/github-darkby theme, and builds quiz IDs fromwindow.location.pathname+name. - Preview:
src/components/Quiz/QuizComponent.tsxrenders with quizdown-extended, registers Shiki languages (Python, Robot, plus ~40 common languages), choosesgithub-light/github-darkby theme, and builds quiz IDs fromwindow.location.pathname+name. - File API:
vite.config.tsexposes/__quiz-editor/listand/__quiz-editor/quizzes/<path>and also serves/quizzes/<path>from the configured quizzes directory (envQUIZDOWN_QUIZZES_DIRset by the CLI). Paths are sandboxed to that directory.
Quiz syntax example
---
shuffleQuestions: false
shuffleAnswers: true
---
### Choose TWO answers that best demonstrate what this editor can handle
Scenario: You need to show teammates that a single Quizdown question can mix formatting, inline code like `**bold**`, and fenced code blocks. The preview should render all of it live.
> This is a hint block with **bold** text.
> ```python
> # This is a fenced Python block inside a hint
> def greet(name):
> return f"Hello, {name}!"
> ```
- [x] **Include a Robot snippet with comments**
```robot
*** Keywords ***
Demo Keyword
Log Rich formatting is supportedRationale: Shows fenced
robotblocks stay highlighted and readable.
[x] Mix prose, lists, and JS code
const message = 'Monaco + Quizdown + Shiki'; console.log(message);Rationale: Demonstrates multi-language highlighting and inline code.
[ ] Rely only on plain text without structure
Rationale: Possible, but does not showcase the editor’s formatting capabilities.
[ ] Avoid rationales to keep the file short
Rationale: Rationales are helpful for authors and are fully supported, so omitting them reduces clarity.
Use the same Quizdown-Extended syntax for frontmatter, choices, rationales, and code blocks. The editor preview reads directly from the quizzes directory you point it to.
### Syntax highlighting languages
Registered with Shiki at runtime:
Python, Robot Framework, JavaScript, TypeScript, JSON, JSONC, HTML, CSS, SCSS, Less, Bash, ShellScript, PowerShell, Dockerfile, Makefile, Markdown, YAML, TOML, SQL, GraphQL, XML, INI, Properties, Pug, Handlebars, Vue, Go, Rust, Java, Kotlin, Swift, C, C++, C#, Objective-C, PHP, Ruby, Perl, Lua, Dart, Scala, Groovy, R, F#, Diff.
## Notes & constraints
- Quizzes are always relative to the configured quizzes directory; the CLI sets `QUIZDOWN_QUIZZES_DIR`, defaulting to `./quizzes`.
- `public/quizzes` must **not** be published to npm; it is ignored via `.npmignore`.
- Theme is controlled via `data-theme`/`color-scheme`; Monaco uses custom `github-light`/`github-dark` (based on `vs`/`vs-dark`), Shiki uses `github-light`/`github-dark`.