🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@kitbook/mdsvex-shiki-twoslash

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kitbook/mdsvex-shiki-twoslash

A plugin for MDSvex that highlights code blocks using shiki-twoslash

latest
Source
npmnpm
Version
1.0.0-beta.31
Version published
Weekly downloads
650
1705.56%
Maintainers
1
Weekly downloads
 
Created
Source

mdsvex-shiki-twoslash

Usage

  • npm i -D @kitbook/mdsvex-shiki-twoslash

  • Add to your mdsvex.config.js:

import { defineMDSveXConfig as defineConfig } from 'mdsvex'
import { shikiTwoslashHighlighter } from '@kitbook/mdsvex-shiki-twoslash'

const config = defineConfig({
  // ...
  highlight: shikiTwoslashHighlighter({ themes: ['dark-plus'] }),
})

export default config
  • Add the css to your project: import "@kitbook/mdsvex-shiki-twoslash/shiki-twoslash.css"; (or import from https://www.unpkg.com/@kitbook/mdsvex-shiki-twoslash@0.0.3/src/shiki-twoslash.css) > I recommend you read through the entire CSS and adjust to your liking. It's been optimized for dark-plus, but as you'll see from the light-plus version, there's no border around the code. So it's a good starting point but you really should look it over and make it fit your needs.

Themes

ShikiTwoslash will default to using the dark-plus and light-plus themes if you don't pass a theme/themes option. If you leave alone the themes option and let it spit out both dark and light versions, you can then use media queries to show the desired option depending on dark/light mode. To adjust themes you could simply look at the default ones found in the themes folder of the shiki package. See also the Shiki-Twoslash docs and Shiki docs for more about themes as it's very flexible in allowing you to add any VS Code theme or even create a new one via a json file.

These initially got me going, but really in hindsight, just reading the the Shiki-Twoslash docs and Shiki docs right from the start would have been better.

Keywords

mdsvex

FAQs

Package last updated on 27 Apr 2024

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