Socket
Book a DemoInstallSign in
Socket

plain-shiki

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plain-shiki

Highlight your plaintext via Shiki

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

Plain Shiki

version downloads license

Highlight your plaintext in any container via Shiki.

By using the CSS Custom Highlight API, code can be highlighted on plain text nodes without rich text. It will help you get the lightest code editor.

Installation

pnpm i plain-shiki

Usage

  • Firstly, create any element that can contain text nodes, e.g. <div class="plain-shiki"></div>

  • Add the contenteditable attribute to this element. If you don't mind the compatibility of the target browser, you can specify its value as plaintext-only

  • Write the following code:

import { createPlainShiki } from "plain-shiki";
import { createHighlighterCore } from "shiki/core";
import { createJavaScriptRegexEngine } from "shiki/engine-javascript.mjs";
import grammarTs from "shiki/langs/typescript.mjs";
import vitesseDark from "shiki/themes/vitesse-dark.mjs";
import vitesseLight from "shiki/themes/vitesse-light.mjs";

const shiki = await createHighlighterCore({
  langs: [grammarTs],
  themes: [vitesseLight, vitesseDark],
  engine: createJavaScriptRegexEngine(),
});

const el = document.querySelector(".plain-shiki") as HTMLElement;

createPlainShiki(shiki).mount(el, {
  lang: "ts",
  themes: {
    light: "vitesse-light",
    dark: "vitesse-dark",
  },
});

Keywords

shiki

FAQs

Package last updated on 02 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts