https://github.com/gera2ld/tw-prism
TiddlyWiki plugin to provide syntax highlight with PrismJS
https://github.com/gera2ld/tw-prism
tiddlywiki-plugin tiddlywiki5
Last synced: over 1 year ago
JSON representation
TiddlyWiki plugin to provide syntax highlight with PrismJS
- Host: GitHub
- URL: https://github.com/gera2ld/tw-prism
- Owner: gera2ld
- License: mit
- Created: 2020-11-23T15:37:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-06T15:11:49.000Z (over 3 years ago)
- Last Synced: 2025-04-15T06:43:19.971Z (over 1 year ago)
- Topics: tiddlywiki-plugin, tiddlywiki5
- Language: JavaScript
- Homepage: https://gera2ld.github.io/tw-prism/
- Size: 604 KB
- Stars: 11
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tw-prism

This is a [TiddlyWiki](https://tiddlywiki.com/) plugin for syntax highlight with [PrismJS](https://prismjs.com/).
Demo: .
## Why this?
There is an official tiddlywiki [plugin](https://github.com/Jermolene/TiddlyWiki5/tree/master/plugins/tiddlywiki/highlight) for syntax highlight but it is based on an old version of [highlight.js](https://github.com/isagalaev/highlight.js). It is not easy to update to a newer version or customize styles.
This plugin was created with automation in mind.
Dependencies like PrismJS are defined in package.json and can be easily updated to the latest version with the help of [npm-check-updates](https://github.com/raineorshine/npm-check-updates). Supported languages and additional aliases are defined in `scripts/build.mjs`.
There is [a dedicated tool](https://gera2ld.github.io/tw-prism/diy.html) for customization of this plugin. You can pick the languages you like and your favorite theme there.
## Installation
See .
## Building from source
You can edit definitions and rebuild the plugin by:
```bash
$ yarn build
```
The generated plugin can be found at `dist/gera2ld/prism`.
To visit the demo, open `dist/data/output/index.html`.
## Local usage
```bash
# Link dist/gera2ld/prism to your plugins directory
$ mkdir -p plugins/gera2ld
$ ln -s /path/to/tw-prism/dist/gera2ld/prism plugins/gera2ld
# Start server with TIDDLYWIKI_PLUGIN_PATH
$ TIDDLYWIKI_PLUGIN_PATH=plugins tiddlywiki data
```