0.1.26 • Published 2 months ago

solid-highlight v0.1.26

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

solid-highlight

size size npm pnpm

solid-highlight

Documentation

Installation

npm i solid-highlight
# or
yarn add solid-highlight
# or
pnpm add solid-highlight

Usage

Importing component

import { Highlight } from "solid-highlight";

Adding styles

Choose the theme for syntax highlighting and add corresponding styles of prism.js by importing in your index.tsx file

import "prismjs/themes/prism-okaidia.min.css";

The styles will most likely be in node_modules/prismjs/themes folder.

Adding languages

Choose the languages available for syntax highlighting by importing in your index.tsx file

import "prismjs/components/prism-typescript";

The languages will most likely be in node_modules/prismjs/components folder.

Properties

PropertyTypeDefaultDescription
classstringCustom css classes to be included
languagestringjavascriptLanguage of code to be highlighted

Syntax highlighting of code snippet

Code snippet that requires syntax highlighting should be passed as children to Highlight component in string format.

import { Highlight, Language } from "solid-highlight";

const [language, setLanguage] = createSignal<Language>(Language.JAVASCRIPT);
<Highlight language={language()}>
  {" "}
  {"function foo() { return 'bar' }"}{" "}
</Highlight>;
0.1.26

2 months ago

0.1.20

3 months ago

0.1.21

3 months ago

0.1.22

3 months ago

0.1.23

3 months ago

0.1.24

2 months ago

0.1.25

2 months ago

0.1.19

3 months ago

0.1.17

4 months ago

0.1.18

4 months ago

0.1.14

4 months ago

0.1.15

4 months ago

0.1.16

4 months ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago