Skip to content

About

Cloudron NodeBB plugin for our custom markdown code block highlighter

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

nodebb-plugin-cloudron-codehighlighter

Code block highlighting for forum.cloudron.io in the Cloudron brand colors, with Cloudron-specific tokens in bash and Dockerfile, and hover hints that link to docs.cloudron.io.

Requires NodeBB 4.12+ with nodebb-plugin-markdown (highlighting enabled). NodeBB 3 and older are not supported.

Install

The plugin is not on npm. Install it from GitHub in the NodeBB directory:

npm install cloudron-io/nodebb-plugin-cloudron-codehighlighter
./nodebb activate nodebb-plugin-cloudron-codehighlighter
./nodebb build

Then restart NodeBB. To pin a release, append a tag: cloudron-io/nodebb-plugin-cloudron-codehighlighter#v0.1.0.

Settings

In ACP > Plugins > Markdown:

  • Default highlight language: plaintext. Without it, highlight.js guesses a language, and plain English quotes come out as armasm or smali.
  • Keep a light highlight theme selected. The few token types this theme does not style (hljs-code, hljs-formula) fall back to it.

What it does

  • A highlight.js theme in Cloudron colors for every language, light and dark mode. Cloudron blue only marks Cloudron things. Every token color meets WCAG AA (4.5:1) in both modes.
  • In bash and Dockerfile blocks, marks the cloudron CLI and its subcommands, cloudron-support, $CLOUDRON_* variables, /app/data and /app/code paths, gosu cloudron:cloudron, common server tools and cloudron/base images.
  • Hovering or tapping a marked token shows a short explanation and a Docs ↗ link to the matching docs.cloudron.io section. The code itself has no links, so selecting and copying code works as before.
  • Adds dockerfile and nginx highlighting, and env, dotenv and conf code fences (highlighted as ini).

Reporting a wrong hint

Open an issue with the token and the link it shows in the issue tracker.

About

Cloudron NodeBB plugin for our custom markdown code block highlighter

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages