A Node.js tool for generating syntax-highlighted HTML code snippets for use in RISE modules.
- Place formatted code files in
src/snippets/
(group by language). - On build each file is converted to a standalone, syntax-highlighted (based on language) HTML snippet using Handlebars and Highlight.js.
- On build output is written to the
public/
directory, including anindex.html
and aniframes.html
with ready-to-copy iframe tags.
Do not delete existing snippets unless 100% sure as they are used in live modules.
- Create a branch for your snippets.
- Add your code snippets to
src/snippets/
(create a subfolder for your language if not already present).
- To view locally run
npm build
to generatepublic
.
- Open a Pull Request to
main
.
On merge, a GitHub Action will:
- Build the HTML output.
- Deploy the
public/
directory to thegh-pages
branch.- If broken and as a last resort there is a manual deploy script
npm run build
- If broken and as a last resort there is a manual deploy script
Your snippets will then be available online for embedding in RISE modules.
src/
module-projects # Store Specific Projects Related to Modules
snippets/ # Add your code files here
templates/ # Handlebars templates
utils/ # Build utilities
index.js # Main script for processing snippets
public/ # Generated HTML output (auto-deployed)
npm install
npm run build
This project uses Vitest (https://vitest.dev/) for testing. To run tests:
npm test
This is a folder to keep any module specific source code that is not large enough to be its own repository.